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 Egor Samarkhanov <sl...@actimind.com> on 2006/07/26 11:13:29 UTC

Re[2]: [Axis2] Problem with String[] and null elements in it

Hello !

Done:
http://issues.apache.org/jira/browse/AXIS2-932

Tuesday, July 25, 2006, 7:51:04 PM, you wrote:

DJ> Hi Egor;
DJ> Can you please create a JIRA , this is a bug in Axis2.

DJ> Thanx
DJ> Deepal

DJ> Egor Samarkhanov wrote:

>>Hello !
>>
>>I created a simple service with the following method:
>>
>>public String[] testStringArrayWithNulls( String[] sarray )
>>{
>>  return sarray;
>>}
>>
>>Then I generated WSDL file (Java2WSDL) and got the following types in
>>it:
>>
>><xs:element name="testStringArrayWithNulls">
>>  <xs:complexType>
>>    <xs:sequence>
>>      <xs:element minOccurs="0" type="xs:string" name="sarray" maxOccurs="unbounded"/>
>>    </xs:sequence>
>>  </xs:complexType>
>></xs:element>
>><xs:element name="testStringArrayWithNullsResponse">
>>  <xs:complexType>
>>    <xs:sequence>
>>      <xs:element minOccurs="0" type="xs:string" name="return" maxOccurs="unbounded"/>
>>    </xs:sequence>
>>  </xs:complexType>
>></xs:element>
>>
>>
>>Then I added nillable="true" attribute manually to each item (to make .NET send
>>nulls in SOAP), so the types are:
>>
>><xs:element name="testStringArrayWithNulls">
>>  <xs:complexType>
>>    <xs:sequence>
>>      <xs:element minOccurs="0" type="xs:string" name="sarray"
>> maxOccurs="unbounded" nillable="true"/>
>>    </xs:sequence>
>>  </xs:complexType>
>></xs:element>
>><xs:element name="testStringArrayWithNullsResponse">
>>  <xs:complexType>
>>    <xs:sequence>
>>      <xs:element minOccurs="0" type="xs:string" name="return"
>> maxOccurs="unbounded"  nillable="true"/>
>>    </xs:sequence>
>>  </xs:complexType>
>></xs:element>
>>
>>Then I deployed this service and tested it with a simple .NET client
>>that sends the following array (the operation is document/literal):
>>
>>[null, "str", null, "str", null]
>>
>>The SOAP message from .NET is as follows:
>>
>><?xml version='1.0' encoding='utf-8'?>
>><soap:Envelope
>>xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>  <soap:Body>
>>    <testStringArrayWithNulls xmlns="http://org.apache.axis2/xsd">
>>      <sarray xsi:nil="true" />
>>      <sarray>str</sarray>
>>      <sarray xsi:nil="true" />
>>      <sarray>str</sarray>
>>      <sarray xsi:nil="true" />
>>    </testStringArrayWithNulls>
>>  </soap:Body>
>></soap:Envelope>
>>
>>But for some reason my service gets:
>>
>>["", "str", "", "str", ""]
>>
>>All null values in the array are replaced with empty strings :(
>>
>>So, I have two questions:
>>
>>1. Why Axis replaces nulls with empty strings when the nulls are
>>   marked with xsi:nil="true" attribute in SOAP message? Is this a
>>   bug?
>>
>>2. Why Java2WSDL doesn't add nillable="true" to Object array elements
>>   automatically?
>>
>>------------------------------------
>>Best regards,
>>Egor Samarkhanov (slash@actimind.com)
>>Actimind, Inc.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>>
>>  
>>



DJ> ---------------------------------------------------------------------
DJ> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
DJ> For additional commands, e-mail: axis-user-help@ws.apache.org



------------------------------------
Best regards,
Egor Samarkhanov (slash@actimind.com)
Actimind, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org