axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amila Chinthaka Suriarachchi (JIRA)" <>
Subject [jira] Commented: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name
Date Mon, 01 Sep 2008 04:31:44 GMT


Amila Chinthaka Suriarachchi commented on AXIS2-3825:

I went through the schema generating logic and parsing logic and found they use different
approaches. This is the cause of this problem.

Lets take this POJO.

public class Person {

    private String x;

    public int getY() {
        return 0;

    public void setY(int y) {



The schema generator use the fields to generate the schema and hence it shows x in the xsd.
But parsing logic uses the PropertyDescriptors and it search for a y. 

I think we need to use the same logic using Property descriptors at the schema generator logic
as well. I'll have a more look on to it.

> Object's property not being deserialized because of mismatch of schema property name
and Java property name
> -----------------------------------------------------------------------------------------------------------
>                 Key: AXIS2-3825
>                 URL:
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.4
>         Environment: Axis2 1.4 (revision 657751 from 1_4 branch)
>            Reporter: Detelin Yordanov
>            Assignee: Amila Chinthaka Suriarachchi
>         Attachments: BeanUtil_patch.txt, tcpmon.log,
> Hi guys,
>  I have the following problem - I have a simple bean with a property that starts with
an uppercase letter (e.g. ID).
> public class Person {
>     protected Integer id;
>     protected String name;
>     public Integer getID() {  return id; }
>     public void setID(Integer id) { = id; }
>     public String getName() { return name; }
>     public void setName(String name) { = name; }
> }
> When I generate the schema element for it (using Java2WSDL), it's being generated with
lowercase - "iD":
> <xs:complexType name="Person">
>     <xs:sequence>
>         <xs:element minOccurs="0" name="iD" nillable="true" type="xs:int"/>
>         <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/>
>     </xs:sequence>
> </xs:complexType>
> That's not a problem by itself, the real problem, however, is that this property does
not get deserialized corectly on the server
> side and the service receives a person object with null ID:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="">1</ns1:iD>
>                <ns1:name xmlns:ns1="">Detelin</ns1:name>
> </ns2:inPerson>
> <ns:return xmlns:ax21="" type="">
>                <ax21:iD xmlns:xsi="" xsi:nil="true"
>                <ax21:name>Detelin</ax21:name>
> </ns:return>
> Notice that the returned "iD" property has not been initialized.
> I debugged the deserialization code on the server side and found out that the reason
for this seems to be in the
> org.apache.axis2.databinding.utils.BeanUtil#deserialize(Class, OMElement,ObjectSupplier,
String) method.
> The following code at line 429 of BeanUtil(revision 657751):
> PropertyDescriptor prty = (PropertyDescriptor)properties.remove(partsLocalName);
> is not finding the property descriptor since it searches using "iD" property name, while
the property descriptor name
> has been resolved by the java.beans.Introspector to "ID".
> Since the property descriptor is not found, the Person instance does not get its property
written and the service receives null,
> and hence the nil element in the response.
> Regards,
>    Detelin

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:
For additional commands, e-mail:

View raw message