Hi all

I've found something weird in Array serialization :

We have a Bean that hold an array of something (here its an array of Book), it provides methods to access its content (may be a getter or indexed getter)

And I see that the serilaized message looks different if we use indexed getter or direct getter !!

Here are the traces :

#1:
without indexed methods :
<?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>
<echoInOutBookArray xmlns="">
<varBook xsi:type="ns1:ArrayOfBook" xmlns:ns1="http://holdertest.org/xsd";>
<arrayOfBook>
<item xsi:type="ns1:Book">
<author xsi:type="xsd:string">author0</author>
<isbn xsi:type="xsd:int">0</isbn>
<title xsi:type="xsd:string">title0</title>
</item>
<item xsi:type="ns1:Book">
<author xsi:type="xsd:string">author1</author>
<isbn xsi:type="xsd:int">1</isbn>
<title xsi:type="xsd:string">title1</title>
</item>
</arrayOfBook>
</varBook>
</echoInOutBookArray>
</soapenv:Body>
</soapenv:Envelope>


#2:
with indexed methods :
<?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>
<echoInOutBookArray xmlns="">
<varBook xsi:type="ns1:ArrayOfBook" xmlns:ns1="http://holdertest.org/xsd";>
<arrayOfBook xsi:type="ns1:Book">
<author xsi:type="xsd:string">author0</author>
<isbn xsi:type="xsd:int">0</isbn>
<title xsi:type="xsd:string">title0</title>
</arrayOfBook>
<arrayOfBook xsi:type="ns1:Book">
<author xsi:type="xsd:string">author1</author>
<isbn xsi:type="xsd:int">1</isbn>
<title xsi:type="xsd:string">title1</title>
</arrayOfBook>
</varBook>
</echoInOutBookArray>
</soapenv:Body>
</soapenv:Envelope>


Is this a normal behavior ? I was expecting Axis to always write a SOAPMessage as #2 !
More, we are in document/literal and #1 looks like a soap encoded array (using <item>).


If someone can give me an explanation, I'll be very happy :)

PS : Just try to uncomment the index getter/setter in test.holders.ArrayOfBook, you'll see the differences.
Note : the test is not failing when we uncomment these methods, that's just the message format ...


Regards
Guillaume

Reply via email to