You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Detelin Yordanov (JIRA)" <ji...@apache.org> on 2008/05/28 13:37:44 UTC

[jira] Created: (AXIS2-3825) Bean property generated with lowercase first letter in schema, but returned with uppercase in the response

Bean property generated with lowercase first letter in schema, but returned with uppercase in the response
----------------------------------------------------------------------------------------------------------

                 Key: AXIS2-3825
                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: adb, kernel
         Environment: Axis2 1.4
            Reporter: Detelin Yordanov
             Fix For: 1.4


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) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.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 if I send a request  using ADB client it contains "iD",
while the response returned - "ID":

REQUEST:
<ns2:inPerson>
               <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
               <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
</ns2:inPerson>

RESPONSE:
<ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
               <ax21:ID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
               <ax21:name>Detelin</ax21:name>
</ns:return>

Notice that the returned "ID" property has not even been initialized.
As you might guess, upon receving of the response, ADB client throws "Unexpected subelement ID".

The reason for the lowercase schema element is due to the
org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator#getCorrectName(String wrongName)  method
and has been present since Axis2 1.3 (or maybe even earlier).

The method's javadoc states: "JAM converts the first letter of a field into uppercase, so field "foo" would end up called "Foo".  This method corrects that problem."

Fine, but on server side (see org.apache.axis2.databinding.utils.BeanUtil#getPullParser(..)) JAM returns the property in uppercase - "ID".
The getPullParser(..) method initially skipped properties whose property descriptors were not found, so I just did not get this property included in the 
request (see line 140 in BeanUtil at revision 552171 for example).

Now in Axis2 1.4 I can see that at the same place (now line 172) dims has added the following:

if (propDesc == null) {
    propDesc = (PropertyDescriptor)propertMap.get(
            (property.getSimpleName()));
}

This has been added in revision 649524 of BeanUtil with message: "Sync with Axis2 trunk".

I guess that because of this now the element gets included in the request, however with wrong name.

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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3825) Bean property generated with lowercase first letter in schema, but returned with uppercase in the response

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Detelin Yordanov updated AXIS2-3825:
------------------------------------

        Fix Version/s:     (was: 1.4)
    Affects Version/s: 1.4

> Bean property generated with lowercase first letter in schema, but returned with uppercase in the response
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb, kernel
>    Affects Versions: 1.4
>         Environment: Axis2 1.4
>            Reporter: Detelin Yordanov
>         Attachments: stacktrace.txt, tcpmon_log.txt, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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 if I send a request  using ADB client it contains "iD",
> while the response returned - "ID":
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:ID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
>                <ax21:name>Detelin</ax21:name>
> </ns:return>
> Notice that the returned "ID" property has not even been initialized.
> As you might guess, upon receving of the response, ADB client throws "Unexpected subelement ID".
> The reason for the lowercase schema element is due to the
> org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator#getCorrectName(String wrongName)  method
> and has been present since Axis2 1.3 (or maybe even earlier).
> The method's javadoc states: "JAM converts the first letter of a field into uppercase, so field "foo" would end up called "Foo".  This method corrects that problem."
> Fine, but on server side (see org.apache.axis2.databinding.utils.BeanUtil#getPullParser(..)) JAM returns the property in uppercase - "ID".
> The getPullParser(..) method initially skipped properties whose property descriptors were not found, so I just did not get this property included in the 
> request (see line 140 in BeanUtil at revision 552171 for example).
> Now in Axis2 1.4 I can see that at the same place (now line 172) dims has added the following:
> if (propDesc == null) {
>     propDesc = (PropertyDescriptor)propertMap.get(
>             (property.getSimpleName()));
> }
> This has been added in revision 649524 of BeanUtil with message: "Sync with Axis2 trunk".
> I guess that because of this now the element gets included in the request, however with wrong name.
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Detelin Yordanov updated AXIS2-3825:
------------------------------------

    Attachment:     (was: TypeTest.zip)

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627420#action_12627420 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-3825:
-----------------------------------------------------

fixed the issue. Now schema generation, parsing and serialization done using the property descriptors.

Please have a look.

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Detelin Yordanov updated AXIS2-3825:
------------------------------------

    Comment: was deleted

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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
>         Attachments: tcpmon.log, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Detelin Yordanov updated AXIS2-3825:
------------------------------------

    Attachment:     (was: tcpmon_log.txt)

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Detelin Yordanov updated AXIS2-3825:
------------------------------------

    Attachment:     (was: stacktrace.txt)

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3825) Bean property generated with lowercase first letter in schema, but returned with uppercase in the response

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Detelin Yordanov updated AXIS2-3825:
------------------------------------

    Attachment: stacktrace.txt
                tcpmon_log.txt
                TypeTest.zip

Attached a simple Eclipse project with the service and ADB client I used to test with;
also according log/stacktrace.

> Bean property generated with lowercase first letter in schema, but returned with uppercase in the response
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb, kernel
>         Environment: Axis2 1.4
>            Reporter: Detelin Yordanov
>             Fix For: 1.4
>
>         Attachments: stacktrace.txt, tcpmon_log.txt, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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 if I send a request  using ADB client it contains "iD",
> while the response returned - "ID":
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:ID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
>                <ax21:name>Detelin</ax21:name>
> </ns:return>
> Notice that the returned "ID" property has not even been initialized.
> As you might guess, upon receving of the response, ADB client throws "Unexpected subelement ID".
> The reason for the lowercase schema element is due to the
> org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator#getCorrectName(String wrongName)  method
> and has been present since Axis2 1.3 (or maybe even earlier).
> The method's javadoc states: "JAM converts the first letter of a field into uppercase, so field "foo" would end up called "Foo".  This method corrects that problem."
> Fine, but on server side (see org.apache.axis2.databinding.utils.BeanUtil#getPullParser(..)) JAM returns the property in uppercase - "ID".
> The getPullParser(..) method initially skipped properties whose property descriptors were not found, so I just did not get this property included in the 
> request (see line 140 in BeanUtil at revision 552171 for example).
> Now in Axis2 1.4 I can see that at the same place (now line 172) dims has added the following:
> if (propDesc == null) {
>     propDesc = (PropertyDescriptor)propertMap.get(
>             (property.getSimpleName()));
> }
> This has been added in revision 649524 of BeanUtil with message: "Sync with Axis2 trunk".
> I guess that because of this now the element gets included in the request, however with wrong name.
> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12627383#action_12627383 ] 

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: https://issues.apache.org/jira/browse/AXIS2-3825
>             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, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Detelin Yordanov updated AXIS2-3825:
------------------------------------

    Attachment: tcpmon.log
                TypeTest.zip

Attached a simple Eclipse project that builds the test service and client;

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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
>         Attachments: tcpmon.log, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Detelin Yordanov updated AXIS2-3825:
------------------------------------

    Component/s:     (was: kernel)
    Description: 
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) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.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:

REQUEST:
<ns2:inPerson>
               <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
               <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
</ns2:inPerson>

RESPONSE:
<ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
               <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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





  was:
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) { this.id = id; }
    public String getName() { return name; }
    public void setName(String name) { this.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 if I send a request  using ADB client it contains "iD",
while the response returned - "ID":

REQUEST:
<ns2:inPerson>
               <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
               <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
</ns2:inPerson>

RESPONSE:
<ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
               <ax21:ID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
               <ax21:name>Detelin</ax21:name>
</ns:return>

Notice that the returned "ID" property has not even been initialized.
As you might guess, upon receving of the response, ADB client throws "Unexpected subelement ID".

The reason for the lowercase schema element is due to the
org.apache.axis2.description.java2wsdl.DefaultSchemaGenerator#getCorrectName(String wrongName)  method
and has been present since Axis2 1.3 (or maybe even earlier).

The method's javadoc states: "JAM converts the first letter of a field into uppercase, so field "foo" would end up called "Foo".  This method corrects that problem."

Fine, but on server side (see org.apache.axis2.databinding.utils.BeanUtil#getPullParser(..)) JAM returns the property in uppercase - "ID".
The getPullParser(..) method initially skipped properties whose property descriptors were not found, so I just did not get this property included in the 
request (see line 140 in BeanUtil at revision 552171 for example).

Now in Axis2 1.4 I can see that at the same place (now line 172) dims has added the following:

if (propDesc == null) {
    propDesc = (PropertyDescriptor)propertMap.get(
            (property.getSimpleName()));
}

This has been added in revision 649524 of BeanUtil with message: "Sync with Axis2 trunk".

I guess that because of this now the element gets included in the request, however with wrong name.

Regards,
   Detelin





    Environment: Axis2 1.4 (revision 657751 from 1_4 branch)  (was: Axis2 1.4)
        Summary: Object's property not being deserialized because of mismatch of schema property name and Java property name  (was: Bean property generated with lowercase first letter in schema, but returned with uppercase in the response)

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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
>         Attachments: stacktrace.txt, tcpmon_log.txt, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amila Chinthaka Suriarachchi resolved AXIS2-3825.
-------------------------------------------------

    Resolution: Fixed

fixed the issue

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Detelin Yordanov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Detelin Yordanov updated AXIS2-3825:
------------------------------------

    Attachment: BeanUtil_patch.txt

Hi guys, 
  I found a solution for the problem - since the bean property descriptor name is with uppercase first letter, while the 
schema has been generated with lowercase first letter name (see DefaultSchemaGenerator#getCorrectName(String)), if we cannot find the property descriptor using lowercase first letter element name, we should try with uppercase first letter element name.
I'm attaching the patch, hopefully Amila will be able to take a look at it and apply it.

And all this due to Annogen bug, I'm happy that Axis2 1.5 won't be using Annogen anymore.

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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
>         Attachments: BeanUtil_patch.txt, tcpmon.log, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Assigned: (AXIS2-3825) Object's property not being deserialized because of mismatch of schema property name and Java property name

Posted by "Nandana Mihindukulasooriya (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3825?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nandana Mihindukulasooriya reassigned AXIS2-3825:
-------------------------------------------------

    Assignee: Amila Chinthaka Suriarachchi

> Object's property not being deserialized because of mismatch of schema property name and Java property name
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3825
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3825
>             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, TypeTest.zip
>
>
> 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) { this.id = id; }
>     public String getName() { return name; }
>     public void setName(String name) { this.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:
> REQUEST:
> <ns2:inPerson>
>                <ns1:iD xmlns:ns1="http://data.test.tempuri.org/xsd">1</ns1:iD>
>                <ns1:name xmlns:ns1="http://data.test.tempuri.org/xsd">Detelin</ns1:name>
> </ns2:inPerson>
> RESPONSE:
> <ns:return xmlns:ax21="http://data.test.tempuri.org/xsd" type="org.tempuri.test.data.Person">
>                <ax21:iD xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org