You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Silvano Maffeis (JIRA)" <ax...@ws.apache.org> on 2004/10/29 08:17:34 UTC

[jira] Created: (AXIS-1633) Serializer issue with WSDL sequences holding 0 elements

Serializer issue with WSDL sequences holding 0 elements
-------------------------------------------------------

         Key: AXIS-1633
         URL: http://issues.apache.org/jira/browse/AXIS-1633
     Project: Axis
        Type: Improvement
  Components: Serialization/Deserialization  
    Versions: 1.2RC1    
 Environment: Any
    Reporter: Silvano Maffeis


In Axis 1.2 RC1 I defined the following WSDL sequence:

<complexType name="StringArray">
    <sequence>
        <element name="string" type="string" minOccurs="0"
maxOccurs="unbounded"/>
    </sequence>
</complexType>

as well as a simple "ping" operation returning a StringArray:

<wsdl:message name="PingRequest">
</wsdl:message>

<wsdl:message name="PingResponse">
    <wsdl:part name="out" type="StringArray"/>
</wsdl:message>

Now, if my WebService returns a StringArray holding a zero sized
String[]:

return new StringArray(new String[0])

my "ping" client actually will receive a StringArray holding a null
reference. Meaning, on the client:

StringArray ret = webservice.ping();
ret.getString() is null

I would rather expect my client to also receive a StringArray bearing a
String[0]

=============

Below is a summary of the SOAP responses for 
four different types of returns. 2 and 3 cannot be distinguished by the client. 
It appears that the Axis deserializer (on the client)
always creates a StringArray(null) in both cases.

>From the viewpoint of robustness it would be better behavior 
to return a StringArray(new String[0]) for both cases (2 and 3).

1. return null:
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <pingResponse xmlns="">
         <out xsi:nil="true"/>
      </pingResponse>
   </soapenv:Body></soapenv:Envelope>

2. return new StringArray(null):
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <pingResponse xmlns="">
         <out/>
      </pingResponse>
   </soapenv:Body></soapenv:Envelope>

3. return new StringArray(new String[0]):
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <pingResponse xmlns="">
         <out/>
      </pingResponse>
   </soapenv:Body></soapenv:Envelope>

4. return new StringArray(new String[]{"hello"}):
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <pingResponse xmlns="">
         <out>
            <string>hello</string>
         </out>
      </pingResponse>
   </soapenv:Body></soapenv:Envelope>

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira