axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Todd Doolittle (JIRA)" <>
Subject [jira] Created: (AXIS2-1272) Cannot differentiate between an int sent as 0 and an int sent as nil
Date Fri, 29 Sep 2006 14:54:27 GMT
Cannot differentiate between an int sent as 0 and an int sent as nil

                 Key: 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:element name="firstNumber" type="xsd:int"/>
         <xsd:element name="secondNumber" type="xsd:int"/>

The server returns this response...

   <secondNumber nil="true"/>

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.
**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.
**In the generated classes, for each int value include a isNull() method that would return
a boolean.


This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message