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 Eugene Shershnev <sh...@gmail.com> on 2005/03/10 17:19:00 UTC

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