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/24 21:47:53 UTC
[Axis2] Problem with String[] and null elements in it
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
Re: [Axis2] Problem with String[] and null elements in it
Posted by Deepal Jayasinghe <de...@opensource.lk>.
This is bug in Axis2 , so I will fix that soon .
Egor Samarkhanov wrote:
>Hello !
>
>Guys, could you please comment on this?
>I'm stuck on this issue :(
>
>Thanks in advance.
>
>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 (slash@actimind.com)
>ES> Actimind, Inc.
>
>
>ES> ---------------------------------------------------------------------
>ES> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>ES> 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
>
>
>
>
>
--
Thanks,
Deepal
................................................................
~Future is Open~
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: [Axis2] Problem with String[] and null elements in it
Posted by Egor Samarkhanov <sl...@actimind.com>.
Hello !
Guys, could you please comment on this?
I'm stuck on this issue :(
Thanks in advance.
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 (slash@actimind.com)
ES> Actimind, Inc.
ES> ---------------------------------------------------------------------
ES> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
ES> 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
Re[2]: [Axis2] Problem with String[] and null elements in it
Posted by Egor Samarkhanov <sl...@actimind.com>.
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
Re: [Axis2] Problem with String[] and null elements in it
Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Egor;
Can you please create a JIRA , this is a bug in Axis2.
Thanx
Deepal
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
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
[Axis2] Problem with String[] and null elements in it
Posted by Egor Samarkhanov <sl...@actimind.com>.
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 (slash@actimind.com)
ES> Actimind, Inc.
ES> ---------------------------------------------------------------------
ES> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
ES> 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