xml-soap-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Toomey, Joe" <jtoo...@rational.com>
Subject RE: Array Serialization
Date Mon, 02 Apr 2001 23:19:40 GMT
Unless you attached the code after you starting chaging it, you
are not setting the parameter type to a string array when you build
your parameter vector in your client call.  You're setting it to a string.

Instead of the line:
    params.addElement (new Parameter("inBoard", String.class, inBoard,
null));

Try using:
    params.addElement (new Parameter("inBoard", inBoard.getClass(), inBoard,
null));

--Joe


-----Original Message-----
From: Terry_Truta@i2.com [mailto:Terry_Truta@i2.com]
Sent: Monday, April 02, 2001 6:20 PM
To: soap-user@xml.apache.org
Subject: Re: Array Serialization



I tried "doing nothing" for array serialization and I got the following
error.

Fault detected =
tictactoe.TicTacToeServer.moveTest(java.lang.String,boolean) --
 no signature match
java.lang.Exception
        at tictactoe.TicTacToeClient.getMove(TicTacToeClient.java:157)
        at tictactoe.TicTacToeClient.main(TicTacToeClient.java:65)
Exception in thread "main" java.lang.NullPointerException
        at tictactoe.TicTacToeClient.main(TicTacToeClient.java:67)

Below is my client and server code. Note that when I modified this code to
just to send a String (non array) it worked fine. So I think I need to do
something else in order to get it to work with arrays. I also included the
XML envelopes from the TCP Tunnel tool. As you can see the client seems is
serializing the String array but it doesn't look like the data is being
serialized - just the information about the array object. The fault is
happening on the server side since it is looking for the method with the
signature (String, boolean) and not (String[], boolean). Can you see what
I'm doing wrong? Thanks.

Client code:
public String[] getMove(String[] inBoard) {

    // Build the call.
    Call call = new Call();

    // Service uses standard SOAP encoding
    String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
    call.setEncodingStyleURI(encodingStyleURI);

    // Set service locator parameters
    call.setTargetObjectURI ("urn:TicTacToeServer");
    call.setMethodName ("moveTest");

    // Create input parameter vector
    Vector params = new Vector ();
    params.addElement (new Parameter("inBoard", String.class, inBoard,
null));
    params.addElement (new Parameter("isX", Boolean.class, new
Boolean(true), null));

    call.setParams (params);

 try {
      // Invoke the service ....
      log("Invoking service...");
      Response resp = call.invoke (url,"");
...

My server code is just this:
public String[] moveTest(String[] board, boolean isX)
  {
    System.out.println("Processing move request...");
    if (isX) {
      board[4] = "X";
      return board;
    }
    else {
      board[4] = "O";
      return board;
    }
  }

Finally, Here is the XML Envelopes for the request and response:
--------------------------- Request -----------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV
="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi
="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd
="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<ns1:moveTest xmlns:ns1="urn:TicTacToeServer" SOAP-ENV:encodingStyle
="http://schemas.xmlsoap.org/soap/encoding/">
<inBoard xsi:type="xsd:string">[Ljava.lang.String;@43c749</inBoard>
<isX xsi:type="xsd:boolean">false</isX>
</ns1:moveTest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

------------------------------ Response ---------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV
="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi
="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd
="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>tictactoe.TicTacToeServer.moveTest(java.lang.String,boolean)
-- no signature match</faultstring>
<faultactor>/soap/servlet/rpcrouter</faultactor>
<detail>
<stackTrace>java.lang.NoSuchMethodException:
tictactoe.TicTacToeServer.moveTest(java.lang.String,boolean) -- no
signature match
     at
org.apache.soap.util.MethodUtils.getEntryPoint(MethodUtils.java:194)
     at org.apache.soap.util.MethodUtils.getMethod(MethodUtils.java:548)
     at org.apache.soap.util.MethodUtils.getMethod(MethodUtils.java:528)
     at org.apache.soap.server.RPCRouter.invoke(RPCRouter.java:102)
     at
org.apache.soap.providers.RPCJavaProvider.invoke(RPCJavaProvider.java:124)
     at
org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.java:26
7)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
     at org.apache.tomcat.core.Handler.service(Handler.java:286)
     at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
     at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
     at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
     at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
     at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
     at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
     at java.lang.Thread.run(Thread.java:484)
</stackTrace>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>




 

                    Rainer Faller

                    <rainer.faller@innov        To:
soap-user@xml.apache.org                                     
                    ations.de>                  cc:

                                                Subject:     Re: Array
Serialization                                 
                    04/02/01 06:20 AM

                    Please respond to

                    soap-user

 

 





> Terry_Truta@i2.com schrieb:
>
> Has anyone done array serialization? None of the examples do this. What
do
> you put for the javaType parameter for the mapTypes method of the
> SOAPMappingRegistry object? Better yet does any have some sample code?
> Thanks.

If you want to use the standard datatypes like String or int, nothing
has to be done. No changes to the mapping, no own
serializer/deserializer. For user-defined datatypes follow the
instructions of Stéphane Bélanger posted in this thread.
Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org






---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


Mime
View raw message