You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by tr...@gmx.li on 2004/05/14 09:40:16 UTC
Wrong deserialization of nil=true-elements in BeanDeserializer
Hi!
Weve got a problem here concerning the deserialization of our incoming
SOAP-messages. The ele-ments of our <ANSWER_STRING>-elements with
xsi:nil=true are ignored by the BeanDeserializer.
We redesigned our productive WebServices to be WS-I-conform and have
problems because of this conformity.
The Situation:
We defined our complexType StringArray as follows:
WSDL:
<sequence>
...
<element name="ANSWER_STRING_ARRAY" type="gns:StringArray"
nillable="true"/>
...
</sequence>
XML-Schema:
<complexType name="StringArray">
<sequence>
<element name="StringArrayItem" type="string" nillable="true"
minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
After an request, the Axis-Client gets an answer with three elements from
the server where the second has an attribute saying it is a null-Value:
xsi:nil=true.
SOAP-Answer:
<ANSWER_STRING_ARRAY>
<StringArrayItem
xmlns="http://ws.at.our.company">firstString</StringArrayItem>
<StringArrayItem xsi:nil="true" xmlns=" http://ws.at.our.company "/>
<StringArrayItem xmlns=" http://ws.at.our.company
">thirdString</StringArrayItem>
</ANSWER_STRING_ARRAY>
Up to this point everything is alright. The problem is, that the generated
AXIS-Client-Stub deserializes this SOAP-Element to:
Deserialized Form:
1.Array-Element: firstString
2.Array-Element: thirdString
The real second element, that should be a Java-String-Object with a
null-value is completely ignored.
The responsible changes for this behaviour are located in the lines of code
for the Fastpath-Nil-Checks, added to axis in Revision 1.55.4.3 (viewable
at:
http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java
)
Our questions:
- Is there a way to get an array of three elements deserialized from the
above SOAP-element, so that we get the java.lang.String-Objects:
[fist String;
null;
thirdString]
?
We think the behaviour of Axis is wrong, because we defined our
StringArrayItem-elements with nilla-ble=true.
- Do you approve?
- If the behaviour is wrong, as we believe, how can we get it fixed?
The code:
// Fastpath nil checks...
if (context.isNil(attributes)) {
setChildValue(null, new Integer(collectionIndex++)); //new line
return null;
}
in BeanDeserializer would result in the wanted three String-Objects, but
cause of the nature of Web-Services we do of course not want to distribute
modified Deserializers to our customers.
Thanks for your help,
Sebastian Wiehage
--
NEU : GMX Internet.FreeDSL
Ab sofort DSL-Tarif ohne Grundgebühr: http://www.gmx.net/dsl
Re: Wrong_deserialization_of_nil=�true�-elements_in_BeanDeserializer
Posted by "sreekantan, vijay" <vi...@yahoo.com>.
Sebastian,
I encountered the same problem and posed the question both in the axis-user and axis-dev groups. I did not recieve any response. We have custom deserializers, so we really did not need the Axis Deserializers. But our clients consuming our WSDL will be using Axis and they will be facing a similar problem. Did you open a JIRA for this issue?
Any suggestion on if this is a bug and should be treated as one.
Regards
Vijay
treebeard@gmx.li wrote:
Hi!
We�ve got a problem here concerning the deserialization of our incoming
SOAP-messages. The ele-ments of our -elements with
xsi:nil=�true� are ignored by the BeanDeserializer.
We redesigned our productive WebServices to be WS-I-conform and have
problems because of this conformity.
The Situation:
We defined our complexType �StringArray� as follows:
WSDL:
...
nillable="true"/>
...
XML-Schema:
minOccurs="0" maxOccurs="unbounded"/>
After an request, the Axis-Client gets an answer with three elements from
the server where the second has an attribute saying it is a null-Value:
xsi:nil=�true�.
SOAP-Answer:
xmlns="http://ws.at.our.company">firstString
">thirdString
Up to this point everything is alright. The problem is, that the generated
AXIS-Client-Stub deserializes this SOAP-Element to:
Deserialized Form:
1.Array-Element: �firstString�
2.Array-Element: �thirdString�
The real second element, that should be a Java-String-Object with a
null-value is completely ignored.
The responsible changes for this behaviour are located in the lines of code
for the Fastpath-Nil-Checks, added to axis in Revision 1.55.4.3 (viewable
at:
http://cvs.apache.org/viewcvs.cgi/ws-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java
)
Our questions:
- Is there a way to get an array of three elements deserialized from the
above SOAP-element, so that we get the java.lang.String-Objects:
[�fist String�;
null;
�thirdString�]
?
We think the behaviour of Axis is wrong, because we defined our
StringArrayItem-elements with nilla-ble=�true�.
- Do you approve?
- If the behaviour is wrong, as we believe, how can we get it fixed?
The code:
// Fastpath nil checks...
if (context.isNil(attributes)) {
setChildValue(null, new Integer(collectionIndex++)); //new line
return null;
}
in BeanDeserializer would result in the wanted three String-Objects, but
�cause of the nature of Web-Services we do of course not want to distribute
modified Deserializers to our customers.
Thanks for your help,
Sebastian Wiehage
--
NEU : GMX Internet.FreeDSL
Ab sofort DSL-Tarif ohne Grundgeb�hr: http://www.gmx.net/dsl
---------------------------------
Do you Yahoo!?
SBC Yahoo! - Internet access at a great low price.