wood burning stoves 2.0*
The moose likes Web Services and the fly likes org.apache.axis.client.Call 's invoke method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "org.apache.axis.client.Call Watch "org.apache.axis.client.Call New topic
Author

org.apache.axis.client.Call 's invoke method

Bharat Macwana
Greenhorn

Joined: May 31, 2007
Posts: 3
I have created one web service in eclipse which returns sum of two int as follows
public int Adder(int a, int b){return a+b;}

now following code is generated in stub when i create client...., in this code, invoke
method takes Array of Object, which contains two int to sum up. Can anyone tell me how
invoke will call Adder method in my webservice and how it will extract those two int from
Object Array and how it will pass those int to Adder() method,,

public int add(int in0, int in1) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call _call = createCall();
_call.setOperation(_operations[0]);
_call.setUseSOAPAction(true);
_call.setSOAPActionURI("");
_call.setEncodingStyle(null);
_call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
_call.setOperationName(new javax.xml.namespace.QName("http://test.soa.bang.ind", "add"));

setRequestHeaders(_call);
setAttachments(_call);
try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {new java.lang.Integer(in0), new java.lang.Integer(in1)});

if (_resp instanceof java.rmi.RemoteException) {
throw (java.rmi.RemoteException)_resp;
}
else {
extractAttachments(_call);
try {
return ((java.lang.Integer) _resp).intValue();
} catch (java.lang.Exception _exception) {
return ((java.lang.Integer) org.apache.axis.utils.JavaUtils.convert(_resp, int.class)).intValue();
}
}
} catch (org.apache.axis.AxisFault axisFaultException) {
throw axisFaultException;
}
}
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39530
    
  27
Welcome to JavaRanch.

Although the invoke method takes an array, that's not how the parameters are sent across the wire. Somewhere in the stub files the proper SOAP is created which sends those individually as the parameters. It's just that the invoke method takes an array parameter so that it can accommodate any number of parameters.

I recommend you use a tool like tcpmon (which is part of Axis, and explained in its documentation) to watch the SOAP that gets sent over the wire; it's instructive to see what goes on underneath.


Ping & DNS - updated with new look and Ping home screen widget
Bharat Makwana
Ranch Hand

Joined: May 21, 2007
Posts: 107
Thank you Ulf Dittmer


ॐ सर्वे जना: सुखिनो भवन्तु , तथास्तु |
'May the whole world be happy, so be it'

SCJP1.5, SCWCD1.5
 
Consider Paul's rocket mass heater.
 
subject: org.apache.axis.client.Call 's invoke method
 
Similar Threads
client code to connect to Web services
SOAPMessage Frights
Axis 1.4 Error plz help Connect Exception
Axis1 (1.4) - Simple client proof of concept - SAXParserException: Content is not allowed in prolog
No Such Operation Exception