Invoking with primitive data parameters

The following code is an example Web Service client that will call the echoString method on the public Axis server at Apache.

InvokerFactory factory = new InvokerFactory("jar:///btt/invoker.xml");
Invoker invoker = factory.createInvoker("echoString");
Object result =  invoker.execute(new Object[]{"hello”});
System.out.println(“Sent ‘Hello!', got ‘” + ret +”'”);
The WSDII invoker definition can be defined as the following code:
<WSDII id="echoString" wsdlURL= 
"http://nagoya.apache.org:5049/axis/services/echo.wsdl" 
"operation="echoString"/>

If you have a network connection active, this program can be run as follows: Sent ‘Hello!', got ‘Hello!'

We firstly create a InvokerFactory object, which read the invoker.xml and employ IoC to initialize the DII Invoker elements.

The following table specifies the primitive Java type which the Invoker handled directly.

Table 1. Primitive Java type for invoker
Java type
int
short
byte
long
float
double
boolean
java.lang.String
java.util.Vector
java.util.Hashtable
java.util.HashMap
java.util.Date java.util.Calendar