Polymorphic object returned from POJO service method is serialized in reverse 
order than what is expected by client generated with wsdl2java (when subclass 
contains an array).
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: AXIS2-3956
                 URL: https://issues.apache.org/jira/browse/AXIS2-3956
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
    Affects Versions: 1.2, 1.4
         Environment: Windows XP, Tomcat 5.0.28, Axis2 1.4, also Axis2 1.2.
            Reporter: David R. Kraus


Serialization code provided on the server side by Axis2, based on my POJO and 
its supporting parameter/return objects, serializes a returned polymorphic 
object with subclass fields first, followed by superclass fields, when the 
subclass contains an array.

The client code generated from the WSDL of this POJO based service (using 
wsdl2java-ADB), serializes the polymorphic object in the reverse order with 
superclass fields preceding subclass fields; and also expects that polymorphic 
objects received from the server follow this same order. Since the server 
serializes in the reverse order "unexpected subelement" errors occur.

My assertion is that client serialization code, which is generated from POJO 
WSDL using wsdl2java, should be consistent with POJO server serialization code.

More info below:

I deployed a simple web service as a POJO to both axis2 1.2 and axis2 1.4. This 
service basically echoes back an object which demonstrates inheritance. In this 
example, MWSAttributeObjectInfo is a subclass of MWSObjectInfo. To create the 
client I used wsdl2java (adb) against the deployed POJO service WSDL.

When I invoked the echoAttrObjInfo method, which simply passes in 
MWSAttributeObjectInfo, and receives the same MWSAttributeObjectInfo back, I 
received an "Unexpected subelement arrayAttributeForms" in Axis2 1.2, and  
"Unexpected subelement objCreationTime" in Axis2 1.4.

The client serialized the object to the server with MWSObjectInfo (superclass) 
fields first, followed by subclass fields (rest of MWSAttributeObjectInfo - the 
array). The server responded by passing back the object with the subclass 
fields first (the array), followed by superclass fields (MWSObjectInfo). This 
caused an exception in the client. Axis2 1.2 detected that the array shouldn't 
come first. Axis2 1.4 didn't see the error until after the array was processed, 
getting an exception on the first field after the array(objCreationTime).

I tried a subclass with simple fields (no array), and no error was generated.
 
>From the WSDL:

superclass:
<xs:element name="MWSObjectInfo" type="ax22:MWSObjectInfo" /> 
<xs:complexType name="MWSObjectInfo">
<xs:sequence>
<xs:element name="objCreationTime" nillable="true" type="xs:string" /> 
<xs:element name="objDescription" nillable="true" type="xs:string" /> 
<xs:element name="objID" nillable="true" type="xs:string" /> 
<xs:element name="objIsHidden" type="xs:boolean" /> 
<xs:element name="objModificationTime" nillable="true" type="xs:string" /> 
<xs:element name="objName" nillable="true" type="xs:string" /> 
<xs:element name="objOwner" nillable="true" type="xs:string" /> 
<xs:element name="objParentFolderID" nillable="true" type="xs:string" /> 
<xs:element name="objPath" nillable="true" type="xs:string" /> 
<xs:element name="objState" type="xs:int" /> 
<xs:element name="objType" type="xs:int" /> 
<xs:element name="objVersion" type="xs:int" /> 
</xs:sequence>
</xs:complexType>

subclass:
<xs:element name="MWSAttributeObjectInfo" type="ax22:MWSAttributeObjectInfo" /> 
<xs:complexType name="MWSAttributeObjectInfo">
<xs:complexContent>
<xs:extension base="ax22:MWSObjectInfo">
<xs:sequence>
<xs:element maxOccurs="unbounded" name="arrayAttributeForms" nillable="true" 
type="ax22:MWSHierarchyAttributeFormInfo" /> 
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>


Soap Trace

Client Request sends MWSAttributeObjectInfo(array in subclass serialized at the 
end)..

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body><ns2:echoAttrObjInfo
 xmlns:ns2="http://microstrategy.com/webservices/";>
<ns2:obj xmlns:s13="http://wsftest.com/xsd"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="s13:MWSAttributeObjectInfo">
<s13:objCreationTime>now</s13:objCreationTime>
<s13:objDescription>generic test object</s13:objDescription>
<s13:objID>DAVEKRAUS0002</s13:objID>
<s13:objIsHidden>false</s13:objIsHidden>
<s13:objModificationTime>later</s13:objModificationTime>
<s13:objName>MWSAttributeObjectInfo</s13:objName>
<s13:objOwner>Dave</s13:objOwner>
<s13:objParentFolderID>FOLDERID</s13:objParentFolderID>
<s13:objPath>objPath</s13:objPath>
<s13:objState>1</s13:objState>
<s13:objType>2</s13:objType>
<s13:objVersion>1</s13:objVersion>
<s13:arrayAttributeForms>
<s13:attributeFormID>XXXXXXXXXX</s13:attributeFormID>
<s13:attributeFormName>XXXXXXXXXX</s13:attributeFormName>
<s13:dataType>100</s13:dataType>
</s13:arrayAttributeForms>
<s13:arrayAttributeForms>
<s13:attributeFormID>YYYYYYYYYY</s13:attributeFormID>
<s13:attributeFormName>YYYYYYYYYY</s13:attributeFormName>
<s13:dataType>200</s13:dataType>
</s13:arrayAttributeForms>
</ns2:obj>
</ns2:echoAttrObjInfo></soapenv:Body></soapenv:Envelope>

Server Response echoes back same MWSAttributeObjectInfo object (array in 
subclass serialized first)

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Body>
<ns:echoAttrObjInfoResponse xmlns:ns="http://microstrategy.com/webservices/";>
<ns:return>
<arrayAttributeForms xmlns="http://wsftest.com/xsd";>
<attributeFormID>XXXXXXXXXX</attributeFormID>
<attributeFormName>XXXXXXXXXX</attributeFormName>
<dataType>100</dataType>
</arrayAttributeForms>
<arrayAttributeForms xmlns="http://wsftest.com/xsd";>
<attributeFormID>YYYYYYYYYY</attributeFormID>
<attributeFormName>YYYYYYYYYY</attributeFormName>
<dataType>200</dataType>
</arrayAttributeForms>
<objCreationTime xmlns="http://wsftest.com/xsd";>now</objCreationTime>
<objDescription xmlns="http://wsftest.com/xsd";>generic test 
object</objDescription>
<objID xmlns="http://wsftest.com/xsd";>DAVEKRAUS0002</objID>
<objIsHidden xmlns="http://wsftest.com/xsd";>false</objIsHidden>
<objModificationTime xmlns="http://wsftest.com/xsd";>later</objModificationTime>
<objName xmlns="http://wsftest.com/xsd";>MWSAttributeObjectInfo</objName>
<objOwner xmlns="http://wsftest.com/xsd";>Dave</objOwner>
<objParentFolderID xmlns="http://wsftest.com/xsd";>FOLDERID</objParentFolderID>
<objPath xmlns="http://wsftest.com/xsd";>objPath</objPath>
<objState xmlns="http://wsftest.com/xsd";>1</objState>
<objType xmlns="http://wsftest.com/xsd";>2</objType>
<objVersion xmlns="http://wsftest.com/xsd";>1</objVersion>
</ns:return>
</ns:echoAttrObjInfoResponse>
</soapenv:Body></soapenv:Envelope>




-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to