This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
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 Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "org.apache.axis.client.Call Watch "org.apache.axis.client.Call New topic

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

Bharat Macwana

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.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
_call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
_call.setOperationName(new javax.xml.namespace.QName("http://test.soa.bang.ind", "add"));

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 {
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

Joined: Mar 22, 2005
Posts: 42954
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.
Bharat Makwana
Ranch Hand

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

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

Consider Paul's rocket mass heater.
subject: org.apache.axis.client.Call 's invoke method