Two long params.

[email protected] Wed, 16 Apr 2003 17:52:09 +0200 (MEST)
Newsgroups gmane.comp.java.enhydra.ksoap
Message-ID <[email protected]>
Hi, 

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

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:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at
org.nowhere.mobile.ksoap.chatsrv.SOAPChatServlet.debugInvoke(SOAPChatServlet.java:265)
        at
org.nowhere.mobile.ksoap.chatsrv.SOAPChatServlet.doPost(SOAPChatServlet.java: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.



-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!