Re: Trouble with WOWebServiceClient invoke
Lachlan Deck <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
A bit late but...
On 07/06/2007, at 11:23 PM, Robert Miners wrote:
> I'm consuming a WebService written with ASP.net that has a method
> that uses an 'out' parameter, i.e. of this form.
>
> [WebMethod]
> int GetResultViaOutParam(out int out_param)
>
> I have no problems if the method has no 'out' parameters, i.e. of
> the form.
>
> [WebMethod]
> int GetResultWith2InParams(int param1, int param2)
>
> The WebObject code for the 'no out params' method is
>
> int arg1 = 3;
> int arg2 = 4;
> Object[] arguments = { new Integer(arg1), new Integer(arg2) };
> String operation = new String("GetResultWith2InParams");
> Object res = serviceClient().invoke(serviceName(), operation,
> arguments);
>
> The WebObject code for the 'out param' method is
>
> int arg1 = 0;
> Object[] arguments = { new Integer(arg1) };
> String operation = new String("GetResultViaOutParam");
> Object res = serviceClient().invoke(serviceName(), operation,
> arguments);
>
> The exception that is raised by the attempt to invoke
> 'WebMethodWithOutParam' is
>
> Error: Error invoking operation: javax.xml.rpc.JAXRPCException:
> Number of parameters passed in (1) does not match the
> number of IN/OUT parameters (0) from the addParameter()
> calls.
Did you get this working?
Consider an 'out' parameter like an &arg in C. It returns a value
rather than receives one. As Java has no such concept, it seems you
need to use a holder like this:
javax.xml.rpc.holders.IntHolder outVal = new
javax.xml.rpc.holders.IntHolder();
Object[] arguments = { outVal };
<...>
int receivedOutValue = outVal.value;
See 'holders'
http://ws.apache.org/axis/java/user-guide.html
http://ws.apache.org/axis/java/apiDocs/index.html
with regards,
--
Lachlan Deck