Loading ...
Sorry, an error occurred while loading the content.
 

Multiple Parameters using Java

Expand Messages
  • acalcium
    Hi there all, I am a SOAP newbie and had a question re returning multiple parameters using java. I have looked in the archives and found a identical question
    Message 1 of 1 , Mar 8, 2005
      Hi there all,
      I am a SOAP newbie and had a question re returning multiple parameters
      using java.
      I have looked in the archives and found a identical question in 2003
      which did not resolve my question. Hopefully, things have progressed
      in the 15 months since.

      My java client written using axis1.2RC3,
      snippet follows....
      '''
      call.addParameter("Code",
      org.apache.axis.Constants.XSD_STRING,
      javax.xml.rpc.ParameterMode.IN);
      ... more of the same ...
      call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_ARRAY );

      Object[] ret = (Object[])call.invoke( new Object[]{"Hello",
      "one", "two" );

      for ( int i = 0; i < ret.length; i++ ) {
      System.out.println( "Sent 'Hello!', got '" + ret[i] + "'" );
      }

      '''


      I have a SOAP server written in python which returns the
      the parameters sent as well as a "status" parameter.

      '''
      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      >
      <SOAP-ENV:Body>
      <MyRequestResponse SOAP-ENC:root="1">
      <Result>
      <Code xsi:type="xsd:string">Hello</LocalOPCode>
      <Status xsi:type="xsd:string">success</Status>
      <Misc xsi:type="xsd:string">one</LocalTAX>
      <Timestmap xsi:type="xsd:string">two</BridgeTNXNo>
      </Result>
      </MyRequestResponse>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      '''

      My results are
      Sent 'Hello!', got 'Hello'
      Sent 'Hello!', got 'success'
      Sent 'Hello!', got 'one'
      Sent 'Hello!', got 'two'



      From the client, it seems like call.invoke() returns
      an array.

      I need to be able to distinguish which parameter is the
      "status" parameter. This information is lost cos the
      client gets back the results in an array.

      Any suggestions as to how I can do this?
      I'm not sure if I can depend on the order in the array.

      I could use something like jdom to unmarshall the XML
      but thought AXIS might have something that would be
      similar.

      Many thanks in advance,
      Chai
    Your message has been successfully submitted and would be delivered to recipients shortly.