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 "Deepal Jayasinghe (JIRA)" <ji...@apache.org> on 2006/09/01 06:14:22 UTC
[jira] Resolved: (AXIS2-932) axis2 doesn't receive null values
correctly
[ http://issues.apache.org/jira/browse/AXIS2-932?page=all ]
Deepal Jayasinghe resolved AXIS2-932.
-------------------------------------
Resolution: Fixed
fixed in current SVN
> axis2 doesn't receive null values correctly
> -------------------------------------------
>
> Key: AXIS2-932
> URL: http://issues.apache.org/jira/browse/AXIS2-932
> Project: Apache Axis 2.0 (Axis2)
> Issue Type: Bug
> Components: databinding
> Affects Versions: 1.0
> Environment: Java services (axis2) and .NET client.
> Reporter: Egor Samarkhanov
> Assigned To: Deepal Jayasinghe
>
> 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 class gets:
> ["", "str", "", "str", ""]
> All null values in the array are replaced with empty strings :(
> =============
> I also tried to return the same array (with nulls) form the method
> and axis made the following SOAP response:
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Header />
> <soapenv:Body>
> <ns:testStringArrayWithNullsResponse xmlns:ns="http://org.apache.axis2/xsd">
> <return>
> </return>
> <return>str</return>
> <return>
> </return>
> <return>str</return>
> <return>
> </return>
> </ns:testStringArrayWithNullsResponse>
> </soapenv:Body>
> </soapenv:Envelope>
> This response actually sends empty strings (and .NET client shows
> them). To me the correct SOAP response should be as follows:
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Header />
> <soapenv:Body>
> <ns:testStringArrayWithNullsResponse xmlns:ns="http://org.apache.axis2/xsd">
> <return xsi:nil="true"/>
> <return>ssttrriinngg</return>
> <return xsi:nil="true"/>
> <return>ssttrriinngg</return>
> <return xsi:nil="true"/>
> </ns:testStringArrayWithNullsResponse>
> </soapenv:Body>
> </soapenv:Envelope>
> 1. Axis2 should correctly handle nulls in requests and responses (shouldn't replace them
> with empty strings).
> 2. Java2WSDL should add nillable="true" to Object array elements automatically
> (probably not only to Object[] but to any "nullable" type).
--
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org