- rpc/encoded Style

This section provides a tutorial example on how to invoke an RPC method based Web service using Axis2 RPCServiceClient class. Input parameters and return values are handled as Java data objects instead of OMElement objects.

To test the org.apache.axis2.rpc.client.RPCServiceClient class, I wrote this client test program,

 * Copyright (c) 2009 All Rights Reserved.
import javax.xml.namespace.QName;
import org.apache.axis2.rpc.client.RPCServiceClient;
import org.apache.axis2.client.Options;
import org.apache.axis2.transport.http.HTTPConstants;
class Axis2GetExchangeRateClient {
   public static void main(String[] args) {

      PrintStream out = System.out;

// Setting initial values
      String server = "";
      if (args.length > 0 && args[0].equals("local"))
         server = "file:///C:/herong/";
      String wsdl = server+"GetExchangeRate_WSDL_11_SOAP_11_RPC.wsdl";

      String tns = "";
      String serviceName = "getExchangeRateService";
      String portName = "getExchangeRatePort";

      try {
         RPCServiceClient client = new RPCServiceClient(null,
            new URL(wsdl), new QName(tns, serviceName), portName);
         Options option = client.getOptions();

// Building the input parameter array
         Object[] inputArgs = new Object[3];
         inputArgs[0] = new String("USD");
         inputArgs[1] = new String("JPY");
         inputArgs[2] = new String("2018-08-08");

// Building the return value type array
         Class[] returnTypes = new Class[1];
         returnTypes[0] = Class.forName("java.lang.String");

// Invoking the Web service
         Object[] returnValues = client.invokeBlocking(
      new QName(tns, "GetExchangeRate"),
      inputArgs, returnTypes);

// Printing the return value

      } catch (Exception e) {

In this program, I used the WSDL document located at GetExchangeRate_WSDL_11_SOAP_11_RPC.wsdl. This Web services uses the rpc/encoded message style.

Output of this program is presented below:

herong> java -cp .;\local\axis2\lib\* Axis2GetExchangeRateClient


Cool. My test program worked nicely. But:

Table of Contents

 About This Book

 Introduction to WSDL 2.0

 WSDL 2.0 Document Structure and Syntax

 WSDL Version 2.0 Part 2: Adjuncts

 WSDL 2.0 Document Examples with SOAP Binding

 Using WSDL Document in Java Apache Axis2/Java for WSDL

 Apache Woden for WSDL Documents in Java

 SoapUI - Web Service Testing Tool

 PHP SOAP Extension for WSDL

 Perl SOAP::Lite for WSDL

 Introduction to WSDL 1.1

 WSDL 1.1 Document Structure and Syntax

 WSDL 1.1 Binding Extension for SOAP 1.1

 SoapUI as WSDL 1.1 Testing Tool

 WSDL 1.1 and SOAP 1.1 Examples - Document and RPC Styles

 PHP SOAP Extension for WSDL 1.1

 Perl SOAP::Lite for WSDL 1.1

Apache Axis2/Java for WSDL 1.1

 Creating Service Client with WSDL 1.1 Document

 org.apache.axis2.client.Options - Operation Client Options

 sendReceive() Method - Invoking a Named Operation

 Turning Off the Chunked HTTP Flag

 AXIOM (AXIs Object Model) - document/literal Style

 org.apache.axis2.rpc.client.RPCServiceClient Class - rpc/encoded Style - Socket Server Testing Program

 Capturing the HTTP Request from an Axis2 Client Program

 Using WSDL2Java to Generate Web Service Stub Classes

 WSDL 1.1 Binding Extension for SOAP 1.2

 WSDL 1.1 and SOAP 1.2 Examples - Document and RPC Styles

 SOAP 1.2 Binding - PHP, Java and Perl Clients

 Python SOAP Client: Zeep

 WSDL Related Terminologies

 Archived Tutorials


 Full Version in PDF/EPUB