I'm using POJO (I write a simple java file without extending anything and 
extract it to aar file).
I know that the second request doesn't fit the wsdl but it only doesn't fit 
because of the order. The first request is the main issue here. The issue is 
that even if I change the name of the XML element bug keep the order and type 
the SOAP request will be ok. This causes problems when dealing with arrays.
I have a method that gets two arrays of integers. If I send the first array as 
empty and the second full with two elements, the code will receive the first 
array with two elements and the second array empty. This is because the SOAP 
decoder ignores the names of the arguments.

From: Amila Suriarachchi [mailto:[EMAIL PROTECTED]
Sent: Sunday, November 16, 2008 16:13
To: [email protected]
Subject: Re: SOAP parsing issues


On Tue, Nov 11, 2008 at 12:28 PM, Zvi, Raanan <[EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>> wrote:

Hello,



I'm writing a web service server which uses axis2 1.4.1 and tomcat 6 and I 
noticed some disturbing issues in the way axis2 parse the SOAP xml.

For some reason axis2 SOAP parser ignores the names of the XML elements and 
decides the values of the arguments according to their order in the XML.



I have this simple method:



- <xs:element name="enumerateEntities">

- <xs:complexType>

- <xs:sequence>

  <xs:element minOccurs="0" name="entityId" type="xs:int" />

  <xs:element minOccurs="0" name="entityType" nillable="true" type="xs:string" 
/>

  </xs:sequence>

  </xs:complexType>

  </xs:element>



I can even send this XML and it will work:



<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"; 
xmlns:wsdl="http://wsdl.intf.dcm.intel.com";>

   <soap:Header/>

   <soap:Body>

      <wsdl:enumerateEntities>

         <wsdl:XXX>-1</wsdl:XXX>

         <wsdl:entityType>NODE</wsdl:entityType>

      </wsdl:enumerateEntities>

   </soap:Body>

</soap:Envelope>



If I send this:



<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"; 
xmlns:wsdl="http://wsdl.intf.dcm.intel.com";>

   <soap:Header/>

   <soap:Body>

      <wsdl:enumerateEntities>

         <wsdl:entityType>NODE</wsdl:entityType>

         <wsdl: entityId >-1</wsdl: entityId >

      </wsdl:enumerateEntities>

   </soap:Body>

</soap:Envelope>



Then axis2 tries to put the string "NODE" into the integer argument entityId.



This issue causes a lot of very strange behaviors like if I have a method which 
gets two arrays, and I send an empty array as the first argument and a full 
array as the second argument, then in code I get the value of the second array 
as the first argument and the second argument is empty.



Is there any fix for this?

Are you using a POJO? Anyway it seems that your second request does not match 
the Schema given above.

thanks,
Amila.



Raanan.

---------------------------------------------------------------------

Intel Israel (74) Limited



This e-mail and any attachments may contain confidential material for

the sole use of the intended recipient(s). Any review or distribution

by others is strictly prohibited. If you are not the intended

recipient, please contact the sender and delete all copies.



--
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Reply via email to