Hi!
I have a problem with string arrays containing nulls (WSIT):
Here is my simple service:
@WebService
public class MyServiceImpl
{
@WebMethod()
public String[] testStringArray( String[] s )
{
return new String[] {"s","",null};
}
}
WSIT generates the following WSDL types for it:
<xs:schema xmlns:tns="
http://wsitproto/" xmlns:xs="
http://www.w3.org/2001/XMLSchema" version="1.0"
targetNamespace="
http://wsitproto/">
<xs:element name="testStringArray" type="tns:testStringArray"/>
<xs:element name="testStringArrayResponse" type="tns:testStringArrayResponse"/>
<xs:complexType name="testStringArray">
<xs:sequence>
<xs:element name="arg0" type="xs:string" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="testStringArrayResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" maxOccurs="unbounded" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
I created WCF client and tried to invoke the service with the new String[] {"s","",null} parameter,
but my service received only two first values (only {"s",""}). The last null string is missed.
I examined SOAP envelopes and they look accordingly:
Inbound message:
<s:Envelope xmlns:s="
http://schemas.xmlsoap.org/soap/envelope/">
<s:Header/>
<s:Body xmlns:xsd="
http://www.w3.org/2001/XMLSchema" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<testStringArray xmlns="
http://wsitproto/">
<arg0 xmlns="">s</arg0>
<arg0 xmlns=""/>
</testStringArray>
</s:Body>
</s:Envelope>
Outbound message:
<S:Envelope xmlns:S="
http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:testStringArrayResponse xmlns:ns2="
http://wsitproto/">
<return>s</return>
<return></return>
</ns2:testStringArrayResponse>
</S:Body>
</S:Envelope>
As I understand that's because elements are not marked as nillable="true" in WSDL.
I think the correct WSDL types would be as follows:
<xs:schema xmlns:tns="
http://wsitproto/" xmlns:xs="
http://www.w3.org/2001/XMLSchema" version="1.0"
targetNamespace="
http://wsitproto/">
<xs:element name="testStringArray" type="tns:testStringArray"/>
<xs:element name="testStringArrayResponse" type="tns:testStringArrayResponse"/>
<xs:complexType name="testStringArray">
<xs:sequence>
<xs:element name="arg0" type="xs:string" maxOccurs="unbounded" minOccurs="0" nillable="true"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="testStringArrayResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" maxOccurs="unbounded" minOccurs="0" nillable="true"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
(note the nillable attributes)
And the question is how can I make WSIT generate and correctly handle nillable types in WSDL?
----
Egor