You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jean <Je...@chop.co.za> on 2005/07/01 11:08:58 UTC

Re: Multi dimensional String array

It seems as if the message that is sent to the Soap server is incorrect

I call the Soap service as follows
   call = (Call) service.createCall();
   call.setTargetEndpointAddress(new java.net.URL(url));
   String[][] in1 = new String[][]{{"abc","cba"}, {"def","fed"}};
   call.setOperation("move");
   Object resp = call.invoke(new Object[]{in1});

Which generates the following Soap message parameter
<arg0>
  <arg0 xsi:type="xsd:string">abc</arg0> 
  <arg0 xsi:type="xsd:string">cba</arg0> 
  <arg0 xsi:type="xsd:string">def</arg0> 
  <arg0 xsi:type="xsd:string">fed</arg0> 
</arg0>

But should be generating this (this happens with the old version)
<item soapenc:arrayType="xsd:string[2]">
  <item>abc</item> 
  <item>cba</item> 
</item>
<item soapenc:arrayType="xsd:string[2]">
  <item>def</item> 
  <item>fed</item> 
 </item>

Am I doing something wrong, or is there perhaps a problem with axis?

  ----- Original Message ----- 
  From: Jean 
  To: axis-user@ws.apache.org 
  Sent: Thursday, June 30, 2005 3:39 PM
  Subject: Multi dimensional String array


  Hi,

  I'm trying to call a method with a multi dimensional array as follows

  public java.lang.String move(java.lang.String[][] in0) throws java.rmi.RemoteException;

  The problem is that when I do the call my array is not built correctly, the array 
  new String[][]{{"abc","cba"}, {"def","fed"}};
  Should read as follows
  0    << [0] abc   << [1] cba
  1    << [0] def   << [1] fed

  But I get the following
  0    << [0] abc
  1    << [0] cba
  2    << [0] def
  3    << [0] fed

  I'm currently using axis 1.2.1 final which gives me this result, one of the axis 1.2 RC versions used to do it correctly but now I have a problem since changing the version.  I don't really want to go back to the RC, how can I get this to work?

  Regards,
  Jean

Re: Multi dimensional String array

Posted by Jean <Je...@chop.co.za>.
I've managed to fix this issue by changing my call to use the wsdl

String url = "http://localhost:8080/axis/services/FormController?wsdl";
Service service = new Service(url, new QName("FormController", "FormControllerSService"));
String[][] in1 = new String[][] { { "abc", "cba" }, { "def", "fed" } };
Call call = (Call) service.createCall(new QName("FormController"), "move");
call.invoke(new Object[]{in1});

Still however don't know why the old version of Axis did this correctly.

  ----- Original Message ----- 
  From: Jean 
  To: axis-user@ws.apache.org 
  Sent: Friday, July 01, 2005 11:08 AM
  Subject: Re: Multi dimensional String array


  It seems as if the message that is sent to the Soap server is incorrect

  I call the Soap service as follows
     call = (Call) service.createCall();
     call.setTargetEndpointAddress(new java.net.URL(url));
     String[][] in1 = new String[][]{{"abc","cba"}, {"def","fed"}};
     call.setOperation("move");
     Object resp = call.invoke(new Object[]{in1});

  Which generates the following Soap message parameter
  <arg0>
    <arg0 xsi:type="xsd:string">abc</arg0> 
    <arg0 xsi:type="xsd:string">cba</arg0> 
    <arg0 xsi:type="xsd:string">def</arg0> 
    <arg0 xsi:type="xsd:string">fed</arg0> 
  </arg0>

  But should be generating this (this happens with the old version)
  <item soapenc:arrayType="xsd:string[2]">
    <item>abc</item> 
    <item>cba</item> 
  </item>
  <item soapenc:arrayType="xsd:string[2]">
    <item>def</item> 
    <item>fed</item> 
  </item>

  Am I doing something wrong, or is there perhaps a problem with axis?

    ----- Original Message ----- 
    From: Jean 
    To: axis-user@ws.apache.org 
    Sent: Thursday, June 30, 2005 3:39 PM
    Subject: Multi dimensional String array


    Hi,

    I'm trying to call a method with a multi dimensional array as follows

    public java.lang.String move(java.lang.String[][] in0) throws java.rmi.RemoteException;

    The problem is that when I do the call my array is not built correctly, the array 
    new String[][]{{"abc","cba"}, {"def","fed"}};
    Should read as follows
    0    << [0] abc   << [1] cba
    1    << [0] def   << [1] fed

    But I get the following
    0    << [0] abc
    1    << [0] cba
    2    << [0] def
    3    << [0] fed

    I'm currently using axis 1.2.1 final which gives me this result, one of the axis 1.2 RC versions used to do it correctly but now I have a problem since changing the version.  I don't really want to go back to the RC, how can I get this to work?

    Regards,
    Jean