I have a similar question, but using RPC/Encoded: Weblogic and Axis serialize nested arrays in different ways.
With the same service (weblogic server):
The (Weblogic) WSDL describes this element like this :
<xsd:complexType name="ArrayOfArrayOfString">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[,]">
</xsd:attribute>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>Axis soap envelope :
<strings xsi:type="soapenc:Array" soapenc:arrayType="xsd:string[][5]" xmlns:ns2="java:language_builtins.lang" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <item soapenc:arrayType="xsd:string[3]"> <item>data i=0, j=0</item> <item>data i=0, j=1</item> <item>data i=0, j=2</item> </item> <item soapenc:arrayType="xsd:string[3]"> <item>data i=1, j=0</item> <item>data i=1, j=1</item> <item>data i=1, j=2</item> </item> ... </strings>
Weblogic call : <strings soapenc:arrayType="xsd:string[5,3]"> <string xsi:type="xsd:string">data i=0, j=0</string> <string xsi:type="xsd:string">data i=0, j=1</string> <string xsi:type="xsd:string">data i=0, j=2</string> <string xsi:type="xsd:string">data i=1, j=0</string> <string xsi:type="xsd:string">data i=1, j=1</string> <string xsi:type="xsd:string">data i=1, j=2</string> ... <strings>
For same service, but exposed with Axis 1.2b3 : WSDL says :
<complexType name="ArrayOfArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="soapenc:string[][]"/>
</restriction></complexContent>
</complexType>
Axis call :
<in0 soapenc:arrayType="soapenc:string[][5]" xsi:type="ns1:ArrayOfArrayOf_xsd_string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <item soapenc:arrayType="soapenc:string[3]" xsi:type="soapenc:Array"> <item xsi:type="soapenc:string">data i=0, j=0</item> <item xsi:type="soapenc:string">data i=0, j=1</item> <item xsi:type="soapenc:string">data i=0, j=2</item> </item> <item soapenc:arrayType="soapenc:string[3]" xsi:type="soapenc:Array"> <item xsi:type="soapenc:string">data i=1, j=0</item> <item xsi:type="soapenc:string">data i=1, j=1</item> <item xsi:type="soapenc:string">data i=1, j=2</item> </item> ... </in0>
And Weblogic can't even serialize :
javax.xml.soap.SOAPException: failed to serialize class [[Ljava.lang.String;weblogic.xml.schema.binding.SerializationException: mapping lookup failure. class=class [Ljava.lang.String; class context=TypedClassContext{schemaType=['urn:TestsAxis']:ArrayOfString}
(and I don't know what to do to correct this).
BTW, the SOAP spec is not very clear about this issue.
I don't know which one is correct according the specification... Maybe someone here will have some clue about that.
--
Julien
Anne Thomas Manes a �crit :
According to the WS-I Basic Profile [1] (see Section 4.3.3)
Given the XML Schema Description:
<xsd:element name="MyArray1" type="tns:MyArray1Type"/>
<xsd:complexType name="MyArray1Type">
<xsd:sequence>
<xsd:element name="x" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
The envelope would serialize as (omitting namespace declarations for clarity):
<MyArray1> <x>abcd</x> <x>efgh</x> </MyArray1>
Note that this is the proper way to define an array using document literal.
This type of definition should generate a wrapper (<MyArray1>) for the array
elements (<x>). If you have defined your array this way, but it does not
generate the <MyArray1> wrapper element, then there's obviously a bug.
Nested arrays work pretty much the same way -- there should always be a wrapper element for the array elements.
Given the XML Schema Description:
<xsd:element name="MyArray1" type="tns:MyArray1Type"/>
<xsd:complexType name="MyArray1Type">
<xsd:sequence>
<xsd:element name="MyArray2" type="tns:MyArray2Type" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="MyArray2Type">
<xsd:sequence>
<xsd:element name="x" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
The envelope would serialize as (omitting namespace declarations for clarity):
<MyArray1> <MyArray2> <x>abcd</x> <x>efgh</x> </MyArray2> <MyArray2> <x>ijkl</x> <x>mnop</x> </MyArray2> </MyArray1>
I suspect that the interop problems may be caused by the way the Schema definitions are generated. Can you provide us with the generated XML Schema definitions of the nested arrays?
[1]
http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html#soapenc_Array
- Anne
