Re: Multidimensionality in SOAPLite
"Chen, Li (Research, YOH)" <[email protected]> Mon, 14 Jul 2003 16:34:53 -0400
| Newsgroups | gmane.comp.windows.devel.soap.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Eric,
I'm very rusty with Perl (did only the basics couple of years ago),
so please excuse my ignorance and stupidity...however, here are all the code
I have in the testing system:
1. A testing web service on the server side (on Apache Axis 1.1 final): I
wrote an empty method to emulate the real one (saves me from connecting to
db):
import org.apache.axis.MessageContext;
public class Booyah
{
public static String[][] getPersonData(String[] attributes, String[]
restrictions, String[] name)
{
return new String[][] { {"dummy", "data"}, {"here", "example"} };
}
}
2. The client side Perl code, original version:
#!perl -w
use SOAP::Lite;
@attributes= ("First Name", "Middle Name", "Last Name", "SSO Login ID",
"Component Number", "Effective Start Date");
@restrictions= ("");
@app_name= ("Ultimus");
print SOAP::Lite
-> uri('myService')
-> proxy('http://localhost:8082/axis/services/')
-> getPersonData(\@attributes, \@restrictions, \@app_name)
-> result; #worry about property using the result later
which generates the following SOAP output:
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: 1106 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[6]">
<item xsi:type="xsd:string">First Name</item>
<item xsi:type="xsd:string">Middle Name</item>
<item xsi:type="xsd:string">Last Name</item>
<item xsi:type="xsd:string">SSO Login ID</item>
<item xsi:type="xsd:string">Component Number</item>
<item xsi:type="xsd:string">Effective Start Date</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">Ultimus</item>
</SOAP-ENC:Array>
</namesp1:getPersonData>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
and the response from the server is:
HTTP/1.1 500 Internal Server Error Content-Type: text/xml; charset=utf-8
Transfer-Encoding: chunked Date: Mon, 14 Jul 2003 20:04:59 GMT Server:
Apache Coyote/1.0 Connection: close 1b0 <?xml version="1.0"
encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>java.lang.ArrayStoreException</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope> 0
3. The modified Perl code (which is still wrong since the name is put in the
wrong place):
#!perl -w
use SOAP::Lite;
@attributes= SOAP::Data->type("SOAP-ENC:Array" => "First Name", "Middle
Name", "Last Name", "SSO Login ID", "Component Number", "Effective Start
Date")->name('arg0');
@restrictions= ("");
@app_name= ("Ultimus");
print SOAP::Lite
-> uri('myService')
-> proxy('http://localhost:8082/axis/services/')
-> getPersonData(\@attributes, \@restrictions, \@app_name)
-> result;
4. and the last version I have:
#!perl -w
use SOAP::Lite;
@attributes= ("First Name", "Middle Name", "Last Name", "SSO Login ID",
"Component Number", "Effective Start Date");
SOAP::Data->name('arg0' => \@attributes);
@restrictions= ("");
@app_name= ("Ultimus");
print SOAP::Lite
-> uri('myService')
-> proxy('http://localhost:8082/axis/services/')
-> getPersonData(\@attributes, \@restrictions, \@app_name)
-> result;
which still doesn't work:
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: 1134 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="SOAP-ENC:Array[6]">
<arg0 xsi:type="SOAP-ENC:Array">First Name</arg0>
<arg0 xsi:type="SOAP-ENC:Array">Middle Name</arg0>
<arg0 xsi:type="SOAP-ENC:Array">Last Name</arg0>
<arg0 xsi:type="SOAP-ENC:Array">SSO Login ID</arg0>
<arg0 xsi:type="SOAP-ENC:Array">Component Number</arg0>
<arg0 xsi:type="SOAP-ENC:Array">Effective Start Date</arg0>
</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">Ultimus</item>
</SOAP-ENC:Array></namesp1:getPersonData>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I think you're right about overriding SOAP:Serializer...all I need is fix
this little problem and I can move on to the next client language to work
with. :-)
Thanks again,
Lee
-----Original Message-----
From: Eric Amick [mailto:[email protected]]
Sent: Monday, July 14, 2003 3:47 PM
To: [email protected]
Subject: Re: [SOAP] Multidimensionality in SOAPLite
On Mon, 14 Jul 2003 15:00:06 -0400, you wrote:
>Hi Eric,
> It didn't work (didn't change the format of the message at all),
>then I tried
>
>@attributes= SOAP::Data->type("SOAP-ENC:Array" => "First Name", "Middle
>Name", "Last Name")->name('arg0');
>
>and it still didn't work because the message is now:
>
><?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]">
> <arg0 xsi:type="xsd:string">First Name</arg0>
> <arg0 xsi:type="xsd:string">Middle Name</arg0>
> <arg0 xsi:type="xsd:string">Last Name</arg0>
> </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>
You're changing the type and name in the wrong place; you're changing
the information for the array elements instead of the whole array.
One other suggestion I have is to make the arguments
SOAP::Data->type(arg0 => \@arrayname)
but this is a real long shot.
I'm beginning to think you might have to override the array encoding in
SOAP:Serializer, which is getting out of my league; read the man pages.
Could you also post the code you tried with my suggestion, just so I can
see what you used?
--
Eric Amick
Columbia, MD