Re: Two long params.

Stefan Haustein <[email protected]> Wed, 23 Apr 2003 01:33:59 +0200
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
Am Mittwoch, 16. April 2003 17:52 schrieb [email protected]:


> Hi,
>
> the question is very simple but so far I could not find some example
> that would solve my problem:

Adam,

I did not find anything obvious in the code... can you try printing the value 
of soapReq.toString() to see whether it is constructed correctly?

Best,
Stefan


>
> I use SoapServlet subclass to publish some service class (on windoze +
> tomcat-4.1.24)
> that has among others methods the one below
>
> public void endChat(long mateID, long boardID) {
>   ...
> }
>
> (it is simple chat server - let's skip the matter of usefulness of such
> server - it is just
> "first try app")
>
> well the other methods are called properly - I can call method with one
> "long" as a parameter
> or with an array of bytes. The problem is that when I call this method the
> second paramter
> becomes "null" on the server side. Here is server side envelope:
>
> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://
> schemas.xmlsoap.org/soap/envelope/">
>  <SOAP-ENV:Body
> SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
>   <endChat xmlns="/chat" id="o0" SOAP-ENC:root="1">
>    <arg0 xmlns="" xsi:type="xsd:long">123</arg0>
>    <arg1 xmlns="" xsi:type="xsd:long">342</arg1>
>   </endChat>
>  </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
>
> I have repeated doPost impl (from super) to see some debugs out. My debug
> version of invoke
> method displays something like this on the console:
>
> Added type/property: long/342
> Added type/property: long/null
> java.lang.NullPointerException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3
>9) at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp
>l.java:25) at java.lang.reflect.Method.invoke(Method.java:324)
>         at
> org.nowhere.mobile.ksoap.chatsrv.SOAPChatServlet.debugInvoke(SOAPChatServle
>t.java:265) at
> org.nowhere.mobile.ksoap.chatsrv.SOAPChatServlet.doPost(SOAPChatServlet.jav
>a:120)
>
> the endChat method is called on the client side like this:
>
>       SoapObject rpc = new SoapObject(CHAT_NAMESPACE, "endChat");
>         rpc.addProperty(
>           "arg0",
>           new Long(mateID)
>         );
>
>         rpc.addProperty(
>           "arg1",
>           new Long(boardID)
>         );
>
>         transport.call(rpc);
>
> Of course I can make a workaround like this: change this longs to array of
> bytes and send it
> in this form - or add them to vector and try to send it but I am just
> curious if n-arguments (n>1)method are not allowed or is it a bug. Or maybe
> I just missinterpret the PropertyInfo?
>
> thanks for your answer in advance.
>
> A.