Title: RE: serializing 2D arrays

I haven't done any type mangling myself, but the body of example 2 is a one-dimensional array.  To send that, copy your data into an anytype[6] array.  Unfortunately, I suspect the type attribute will change to 'soapenc:arrayType="xsd:anyType[6]"'.  I don't know what to do about that; your server might not care, or maybe you can fake it by telling Axis what string to put there.

-Bill

// William R. Zwicky
// USA-CERL  (217) 352-6511 x7405
// Champaign, IL

 

> -----Original Message-----
> From: Mark Cassidy [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 19, 2004 3:29 PM
> To: [EMAIL PROTECTED]
> Subject: serializing 2D arrays
>
> We're using Axis 1.1 for our JAX-RPC client to a set of
> webservices.  We're getting back 2D arrays fine from the
> service, but sending a 2D array is having problems over on
> the web service side.
>
> The WSDL only says that the message part that is the 2D array
> is xsd:anyType -- and they're not going to change it. 
>
> Here is an example of how our client is serializing the 2D
> array going out from Axis -
>
>    <avarLineItem
>               xsi:type="soapenc:Array"
>               soapenc:arrayType="xsd:anyType[][2]"
>              
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
>    <item xsi:type="soapenc:Array" soapenc:arrayType="xsd:anyType[3]">
>      <item xsi:type="xsd:string">1</item>
>      <item xsi:type="xsd:string">2</item>
>      <item xsi:type="xsd:string">3</item>
>    </item>
>    <item xsi:type="soapenc:Array" soapenc:arrayType="xsd:anyType[3]">
>      <item xsi:type="xsd:string">4</item>
>      <item xsi:type="xsd:string">5</item>
>      <item xsi:type="xsd:string">6</item>
>     </item>
>    </avarLineItem>
>
>
> But the webservice is looking for something like this  -
>
>
>     <avarLineItem
>               xsi:type="soapenc:Array"
>               soapenc:arrayType="xsd:anyType[2][3]"
>              
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
>      <item xsi:type="xsd:string">1</item>
>      <item xsi:type="xsd:string">2</item>
>      <item xsi:type="xsd:string">3</item>
>      <item xsi:type="xsd:string">4</item>
>      <item xsi:type="xsd:string">5</item>
>      <item xsi:type="xsd:string">6</item>
>    </avarLineItem>
>
> I have tried creating it in Java as Object[][], Object[] with
> ArrayLists inside it, but can't get the object such that Axis
> serializes it as in example two.  I understand that because
> 2D arrays in Java can be ragged, this may not be the natural
> way they get represented with Axis' serialization.  But can
> anyone provide advice of how to do get it serialized as in
> example 2?  Do I have to write a custom serializer to do this?
>
> Thanks for any help,
> - Mark
>
>

Reply via email to