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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]