Personally, I would really like to see
"https://issues.apache.org/jira/browse/AXIS2-3956"; fixed. The
auto-generation/deployment of a web service (via scripts, etc) is much
easier to implement when the service is defined by a POJO, and
inheritance is an important feature.

We have gotten inheritance to work in our main web service offering by
developing the service WSDL-first. Then, if you use wsdl2java to create
server side and client stubs, the serialization problem does not occur.
The POJO problem seems to be related to the fact that the client stubs
(generated by wsdl2java) and the server side POJO serialization do not
agree on the order of the serialization of the array field in the
subclass. Basically, there are two different serialization mechanisms,
which are at odds.

Dave K

-----Original Message-----
From: balaji hari [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 19, 2008 3:59 PM
To: [email protected]
Subject: RE: Inherited object serialized in reverse order by server,
when subclass contains an array.


Hi,

We are facing a similar issue. Did you get a chance to have a workaround
for
this?

The issue in jira is un-assigned.

https://issues.apache.org/jira/browse/AXIS2-3956

The type hierarchy

SubjectDTO(caseSensitive, frequency, ignoreWhiteSpace, key)
       |
SubjectCollectionDTO (collection, contiguous, ordered)
       |
SubjectLinesDTO 


The Response XML:

                      <ns1:subject
xsi:type="com.bmc.bcan.dto.SubjectLinesDTO">
                        <ns1:collection>aaa new-model</ns1:collection>
                        <ns1:collection>
                                aaa authentication login default group
enable
                        </ns1:collection>
                        <ns1:collection>
                                aaa authentication login line
                        </ns1:collection>
                        <ns1:contiguous>false</ns1:contiguous>
                        <ns1:ordered>false</ns1:ordered>
                        <ns1:caseSensitive>false</ns1:caseSensitive>
                        <ns1:frequency>2</ns1:frequency>
        
<ns1:ignoreWhitespace>true</ns1:ignoreWhitespace>
                        <ns1:key xsi:type="com.bmc.bcan.dto.KeyDTO">
        
<ns1:keyString>458169663-8</ns1:keyString>
                        </ns1:key>
                </ns1:subject>

Axis2 ADB error:

Exception in thread "main" org.apache.axis2.AxisFault:
org.apache.axis2.databinding.ADBException: Unexpected subelement
collection
        at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
        at
com.bmc.bcan.ws.service.RuleServiceStub.fromOM(RuleServiceStub.java:1038
)
        at
com.bmc.bcan.ws.service.RuleServiceStub.getRule(RuleServiceStub.java:662
)
        at
com.bmc.bcan.ws.service.RuleServiceStub.main(RuleServiceStub.java:615)
Caused by: java.lang.Exception:
org.apache.axis2.databinding.ADBException:
Unexpected subelement collection
        at
com.bmc.bcan.dto.SubjectDTO$Factory.parse(SubjectDTO.java:827)
        at com.bmc.bcan.dto.RuleDTO$Factory.parse(RuleDTO.java:2059)
        at
com.bmc.bcan.ws.service.GetRuleResponse$Factory.parse(GetRuleResponse.ja
va:422)
        at
com.bmc.bcan.ws.service.RuleServiceStub.fromOM(RuleServiceStub.java:1027
)
        ... 2 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected
subelement
collection
        at
com.bmc.bcan.dto.SubjectDTO$Factory.parse(SubjectDTO.java:823)
        ... 5 more


Right now we are able to get this working using xmlbeans databinding in
the
client side.

Any pointers / workaround highly appreciated.

Balaji







Kraus, David wrote:
> 
> To further clarify: serialization code provided on the server side by
> Axis2, based on my POJO and its supporting parameter/return objects,
> serializes a polymorphic object 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.
> 
>  
> 
> I am going to assume that this is a bug since I don't see this
behavior
> when the subclass does not contain an array.
> 
>  
> 
> Dave Kraus
> 
>  
> 
> ________________________________
> 
> From: Kraus, David 
> Sent: Monday, July 28, 2008 5:49 PM
> To: [email protected]
> Subject: Inherited object serialized in reverse order by server, when
> subclass contains an array.
> 
>  
> 
> 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 against the
> deployed service.
> 
>  
> 
> 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).
> 
>  
> 
> Is this a known bug? I tried a subclass with simple fields (no array),
> and no error was generated.
> 
>  
> 
> Thanks, Dave
> 
>  
> 
> From the WSDL:
> 
>  
> 
> <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>
> 
>  
> 
> <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....
> 
>  
> 
> <?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
> 
>  
> 
> <?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>
> 
>  
> 
>  
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/Inherited-object-serialized-in-reverse-order-by-se
rver%2C-when-subclass-contains-an-array.-tp18702867p19060294.html
Sent from the Axis - User mailing list archive at Nabble.com.


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


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

Reply via email to