Hello !

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). Is it possible to make axis sends something like this:

<?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>

I appreciate any help on this, thanks.

Monday, July 24, 2006, 11:47:53 PM, you wrote:

ES> Hello !

ES> I created a simple service with the following method:

ES> public String[] testStringArrayWithNulls( String[] sarray )
ES> {
ES>   return sarray;
ES> }

ES> Then I generated WSDL file (Java2WSDL) and got the following types in
ES> it:

ES> <xs:element name="testStringArrayWithNulls">
ES>   <xs:complexType>
ES>     <xs:sequence>
ES>       <xs:element minOccurs="0" type="xs:string"
ES> name="sarray" maxOccurs="unbounded"/>
ES>     </xs:sequence>
ES>   </xs:complexType>
ES> </xs:element>
ES> <xs:element name="testStringArrayWithNullsResponse">
ES>   <xs:complexType>
ES>     <xs:sequence>
ES>       <xs:element minOccurs="0" type="xs:string"
ES> name="return" maxOccurs="unbounded"/>
ES>     </xs:sequence>
ES>   </xs:complexType>
ES> </xs:element>


ES> Then I added nillable="true" attribute manually to each item (to make .NET 
send
ES> nulls in SOAP), so the types are:

ES> <xs:element name="testStringArrayWithNulls">
ES>   <xs:complexType>
ES>     <xs:sequence>
ES>       <xs:element minOccurs="0" type="xs:string"
ES> name="sarray" maxOccurs="unbounded" nillable="true"/>
ES>     </xs:sequence>
ES>   </xs:complexType>
ES> </xs:element>
ES> <xs:element name="testStringArrayWithNullsResponse">
ES>   <xs:complexType>
ES>     <xs:sequence>
ES>       <xs:element minOccurs="0" type="xs:string"
ES> name="return" maxOccurs="unbounded"  nillable="true"/>
ES>     </xs:sequence>
ES>   </xs:complexType>
ES> </xs:element>

ES> Then I deployed this service and tested it with a simple .NET client
ES> that sends the following array (the operation is document/literal):

ES> [null, "str", null, "str", null]

ES> The SOAP message from .NET is as follows:

ES> <?xml version='1.0' encoding='utf-8'?>
ES> <soap:Envelope
ES> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
ES> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
ES> xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
ES>   <soap:Body>
ES>     <testStringArrayWithNulls xmlns="http://org.apache.axis2/xsd";>
ES>       <sarray xsi:nil="true" />
ES>       <sarray>str</sarray>
ES>       <sarray xsi:nil="true" />
ES>       <sarray>str</sarray>
ES>       <sarray xsi:nil="true" />
ES>     </testStringArrayWithNulls>
ES>   </soap:Body>
ES> </soap:Envelope>

ES> But for some reason my service gets:

ES> ["", "str", "", "str", ""]

ES> All null values in the array are replaced with empty strings :(

ES> So, I have two questions:

ES> 1. Why Axis replaces nulls with empty strings when the nulls are
ES>    marked with xsi:nil="true" attribute in SOAP message? Is this a
ES>    bug?

ES> 2. Why Java2WSDL doesn't add nillable="true" to Object array elements
ES>    automatically?

ES> ------------------------------------
ES> Best regards,
ES> Egor Samarkhanov ([EMAIL PROTECTED])
ES> Actimind, Inc.


ES> ---------------------------------------------------------------------
ES> To unsubscribe, e-mail: [EMAIL PROTECTED]
ES> For additional commands, e-mail: [EMAIL PROTECTED]



------------------------------------
Best regards,
Egor Samarkhanov ([EMAIL PROTECTED])
Actimind, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to