Unexpected subelement - pojo - Inherited Complex Type
-----------------------------------------------------
Key: AXIS2-3418
URL: https://issues.apache.org/jira/browse/AXIS2-3418
Project: Axis 2.0 (Axis2)
Issue Type: Bug
Components: adb
Affects Versions: 1.3
Environment: jdk jdk1.5.0_14, axis2 1.3, Fedora 8, Intel x86
Reporter: Mehmet Döngel
$AXİS2_HOME/samples/pojo sample,
I created ZEntry class with "String custom" field and updated Entry class to
extend ZEntry class, after deployment I build and run adb client and got
org.apache.axis2.databinding.ADBException: Unexpected subelement city
exception.
Response Message:
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns:findEntryResponse xmlns:ns="http://service.addressbook.sample">
<ns:return xmlns:ax21="http://entry.addressbook.sample/xsd"
type="sample.addressbook.entry.Entry">
<ax21:city>Sesame City</ax21:city>
<ax21:name>Abby Cadabby</ax21:name>
<ax21:postalCode>11111</ax21:postalCode>
<ax21:state>Sesame State</ax21:state>
<ax21:street>Sesame Street</ax21:street>
<ax21:custom
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</ns:return>
</ns:findEntryResponse>
</soapenv:Body>
</soapenv:Envelope>
Reason for that exception is that generated stub expects first "custom"
element because schema for Entry and ZEntry class in wsdl is :
*****************************************************************************************************************************************************************************************************************
<xs:schema xmlns:ax21="http://entry.addressbook.sample/xsd"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://entry.addressbook.sample/xsd">
<xs:complexType name="ZEntry">
<xs:sequence>
<xs:element minOccurs="0" name="custom" nillable="true"
type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Entry">
<xs:complexContent>
<xs:extension base="ax21:ZEntry">
<xs:sequence>
<xs:element minOccurs="0" name="city"
nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="name"
nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="postalCode"
nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="state"
nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="street"
nillable="true" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
*****************************************************************************************************************************************************************************************************************
Reason for expected response (first Entry fields
(city,name,postalCode,state,street) and then super class ZEntry fields (custom)
) is BeanUtil class takes all the fields and put to an arraylist and then
sort that array list. Because ZEntry.custom field comes after Entry.xxx
fields,custom element is serialized last.
When I use AEntry class instead of ZEntry class, no problem occurs.
My solution to this problem is changing BeanUtil class in such a way that,
first get super class properties and sort that properties and then put to an
arrayList containing all properties, and after that get sub class properties
and sort that properties and then put to that arrayList.
Any other ideas, solutions?
--
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]