when I search in the net, i am getting the following example. but i need to pass an object as parameter.
Can any one please help me How to pass an object to call.addparameter() mehtod?
It is defined as follows in wsdl file.
<complexType name="xyzpPacket">
−
<sequence>
<element name="userName" nillable="true" type="xsd:string"/>
<element name="domain" nillable="true" type="xsd:string"/>
<element name="domainAuth" type="xsd:boolean"/>
<element name="userId" nillable="true" type="xsd:long"/>
....
</sequence>
</complexType>
package samples.userguide.example2;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.utils.Options;
import javax.xml.rpc.ParameterMode;
public class CalcClient {
public static void main(
String [] args) throws Exception {
Options options = new Options(args);
String endpoint = "http://localhost:" + options.getPort() +
"/axis/Calculator.jws";
// Do argument checking
args = options.getRemainingArgs();
if (args == null || args.length != 3) {
System.err.println("Usage: CalcClient <add|subtract arg1 arg2");
return;
}
String method = args[0];
if (!(method.equals("add") || method.equals("subtract"))) {
System.err.println("Usage: CalcClient <add|subtract arg1 arg2");
return;
}
// Make the call
Integer i1 = new Integer(args[1]);
Integer i2 = new Integer(args[2]);
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName( method );
call.addParameter("op1", XMLType.XSD_INT, ParameterMode.PARAM_MODE_IN);
call.addParameter("op2", XMLType.XSD_INT, ParameterMode.PARAM_MODE_IN);
call.setReturnType(XMLType.XSD_INT);
Integer ret = (Integer) call.invoke( new Object [] { i1, i2 });
System.out.println("Got result : " + ret);
}
}