Just rerun the test with the latest build - same result.
 
Actually, all 4 strN were serialized as <strN xsi:nil="true"/> when all 4 values were null.
I was expecting an exception on the server side since str3 must not be null (nillable=false & minOccurs=0)
 
Thanks,
Eugene
----- Original Message -----
Sent: Thursday, March 10, 2005 11:54a
Subject: Re: Returning nulls with minOccurs set to 0

Here is another thing I've got in my NULL interop testing between Axis and .Net
 
Here is a type defined like this:
 
      <complexType name="ComplexType">
        <sequence>
          <element name="int0" nillable="true"  minOccurs="0" type="xsd:int"/>
          <element name="int1" nillable="false" minOccurs="0" type="xsd:int"/>
          <element name="int2" nillable="true"  minOccurs="1" type="xsd:int"/>
          <element name="int3" nillable="false" minOccurs="1" type="xsd:int"/>
 
          <element name="str0" nillable="true"  minOccurs="0" type="xsd:string"/>
          <element name="str1" nillable="false" minOccurs="0" type="xsd:string"/>
          <element name="str2" nillable="true"  minOccurs="1" type="xsd:string"/>
          <element name="str3" nillable="false" minOccurs="1" type="xsd:string"/>
        </sequence>
      </complexType>
On the server side, the ComplexType object is constructed like this:
 
    public ComplexType() {
        int0 = null;
        int1 = new Integer(1);
        int2 = null;
        int3 = new Integer(3);
 
        str0 = null;
        str1 = null;   // this violates nillable="false"
        str2 = null;
        str3 = new String("three");
    }
In this case, the value to be transmitted is null and one would expect nothing to be sent over the wire (i.e. no value and no XML tags for the "value"), but instead xsi:nil="true" is being sent:
 
  <soapenv:Body>
    <complexTypeOutResponse xmlns="http://test.enterprise.ent">
      <complexTypeOutReturn>
        <int0 xsi:nil="true"/>
        <int1>1</int1>
        <int2 xsi:nil="true"/>
        <int3>3</int3>
        <str0 xsi:nil="true"/>
        <str1 xsi:nil="true"/>
        <str2 xsi:nil="true"/>
        <str3>three</str3>
      </complexTypeOutReturn>
    </complexTypeOutResponse>
  </soapenv:Body>
 
Is it a bug?
 
Thanks,
Eugene

 
----- Original Message -----
Sent: Thursday, March 10, 2005 11:19a
Subject: Returning nulls with minOccurs set to 0

Hi All,
 
I have a simple test to check the interop issues between Axis 1.2 RC3 server and .Net client.
 
A function returns a String so the element in the WSDL is defined as follows:
 
<element name="nullableStringOutResponse">
  <complexType>
    <sequence>
      <element name="nullableStringOutReturn" nillable="true" minOccurs="0" type="xsd:string"/>
    </sequence>
  </complexType>
</element>
 
and when that function returns null the response looks like this:
 
<soapenv:Body>
  <nullableStringOutResponse xmlns="http://test.enterprise.ent">
    <nullableStringOutReturn xsi:nil="true"/>
  </nullableStringOutResponse>
</soapenv:Body>
 
What I was actually expecting is:
 
<soapenv:Body>
  <nullableStringOutResponse xmlns="http://test.enterprise.ent" />
</soapenv:Body>
 
With minOccurs="0" there is no need for Axis to serialize a null string as it does.
 
This does not cause any problem (at least in my case), but why send any extra bytes when they're not required?
 
Thanks,
Eugene

Reply via email to