Re: Multidimensionality in SOAPLite

"Chen, Li (Research, YOH)" <[email protected]> Mon, 14 Jul 2003 13:17:10 -0400
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <[email protected]>
Hi Eric,
        Thanks! Your recommendation worked, albeit I had to change a piece
of it. Here is what the XML output looks like (from the client) once I
passed references to the arrays instead:

POST /axis/services/ HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: TE, close
Accept: text/xml
Accept: multipart/*
Host: localhost
User-Agent: SOAP::Lite/Perl/0.55
Content-Length: 1103
Content-Type: text/xml; charset=utf-8
SOAPAction: "myService#getPersonData"

<?xml version="1.0" encoding="UTF-8"?>
   <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <SOAP-ENV:Body>
         <namesp1:getPersonData xmlns:namesp1="myService">
            <SOAP-ENC:Array xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:string[3]">
               <item xsi:type="xsd:string">First Name</item>
               <item xsi:type="xsd:string">Middle Name</item>
               <item xsi:type="xsd:string">Last Name</item>
            </SOAP-ENC:Array>
            <SOAP-ENC:Array xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:string[1]">
               <item xsi:type="xsd:string"/>
            </SOAP-ENC:Array>
            <SOAP-ENC:Array xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:string[1]">
               <item xsi:type="xsd:string">myApplication</item>
            </SOAP-ENC:Array>
         </namesp1:getPersonData>
      </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>

Note the element <SOAP-ENC:Array xsi:type=...>

It seems that the name SOAP-ENC:Array is causing
java.lang.ArrayStoreException on the server side (an Axis implementation
there)...so I changed the message manually (inside TCP Monitor, which lets
you change the raw message and test-send again) to:

POST /axis/services/ HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: TE, close
Accept: text/xml Accept: multipart/* Host: localhost User-Agent:
SOAP::Lite/Perl/0.55 Content-Length: 1291
Content-Type: text/xml; charset=utf-8 SOAPAction: "myService#getPersonData"
<?xml version="1.0" encoding="UTF-8"?>
   <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <SOAP-ENV:Body>
         <namesp1:getPersonData xmlns:namesp1="myService">
            <arg0 xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:string[3]">
               <item xsi:type="xsd:string">First Name</item>
               <item xsi:type="xsd:string">Middle Name</item>
               <item xsi:type="xsd:string">Last Name</item>
            </arg0>
            <arg1 xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:string[1]">
               <item xsi:type="xsd:string"/>
            </arg1>
            <arg2 xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:string[1]">
               <item xsi:type="xsd:string">myApplication</item>
            </arg2>
         </namesp1:getPersonData>
      </SOAP-ENV:Body>
   </SOAP-ENV:Envelope>

So instead of <SOAP-ENC:Array... we have <arg0...> and so on. And this
worked!

One more question though, how do I make SOAPLite to generate arg0, etc. for
that specific sub-element instead of SOAP-ENC:Array?

Thanks!

Lee

-----Original Message-----
From: Eric Amick [mailto:[email protected]]
Sent: Saturday, July 12, 2003 10:25 AM
To: [email protected]
Subject: Re: [SOAP] Multidimensionality in SOAPLite


> Hi all,
> I am a user of SOAPLite (from the client side), and would like to
> know the
> following: how do I make SOAPLite web services engine create request
> messages with parameters consisting of multidimensional arrays? (I
> knowthere are mentions of SOAPLite having no such native support --
> even if so,
> how can I "force" it to do so with some work-around?) The web
> service I am
> accessing within the company requires multidimensional array
> parameters,with header in Java:
>
> public static String[][] getPersonData(String[] attributes, String[]
> restrictions, String[] appName)

The input parameters are one-dimensional arrays, which SOAP::Lite can
handle just fine.

>
> Currently, my code:
>
> @attributes= ("First Name", "Middle Name", "Last Name");
>  @restrictions= ("");
>  @app_name= ("myApp");
>
>  print SOAP::Lite
>    -> uri('MyService')
>    -> proxy('http://localhost:8082/axis/services/')
>    -> getPersonData(@attributes, @restrictions, @app_name)
>    -> result;

Pass references to the arrays instead, i.e.,

-> getPersonData(\@attributes, \@restrictions, \@app_name)

Eric Amick
Columbia, MD