[ http://issues.apache.org/jira/browse/AXIS2-1272?page=comments#action_12441253 ] Tom Jordahl commented on AXIS2-1272: ------------------------------------
(Commented on AXIS2-1247 also) Note that an Axis 1.x, any integer type that is nillable has to become a Java Integer. Otherwise you can not tell if 0 is sent or it was omitted. Axsi 2 should follow the same convention. Any nillable type must be converted in to the Java wrapper type. > Cannot differentiate between an int sent as 0 and an int sent as nil > -------------------------------------------------------------------- > > Key: AXIS2-1272 > URL: http://issues.apache.org/jira/browse/AXIS2-1272 > Project: Apache Axis 2.0 (Axis2) > Issue Type: Bug > Components: databinding > Affects Versions: nightly > Environment: Axis 2 nightly, Java 1.4.2, Tomcat 4 > Reporter: Todd Doolittle > > The service I deal with often sends back values a nil (or NULL). For most > datatypes, such as String and Date the value of the object is NULL (using > client code generated by WSDL2JAVA). However for anything that is an > integer, it is set to 0. This makes it impossible to tell if the value in > the message was really a 0, or if it was nil="true". > For example, the type in the wsdl is defined as... > <xsd:element name="response"> > <xsd:complextType> > <xsd:sequence> > <xsd:element name="firstNumber" type="xsd:int"/> > <xsd:element name="secondNumber" type="xsd:int"/> > </xsd:sequence> > </xsd:complexType> > </xsd:element> > The server returns this response... > <response> > <firstNumber>0</firstNumber> > <secondNumber nil="true"/> > </response> > In the client code, response.getFirstNumber() would return 0, and > response.getSecondNumber() would also return 0. > To get around this could we do one of the following... > **When an int is returned from a service as nil="true" set the value to > Integer.MIN_VALUE. > or > **In the generated classes using java.lang.Integer instead of int and in the > case of a nil="true" response, set the Integer object to null. > or > **In the generated classes, for each int value include a isNull() method that > would return a boolean. > Thanks! > Todd -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]