Hi,
I have a serious problem with web services on JBoss (4.2.0 or 4.2.1). When the
service returns Java bean containing an array-type property, in the result this
property is always returned unspecified (empty XML element in the WS response).
Simple test case follows.
Let's have a web service returning a simple bean containing an array of string:
| public TestBean testWS()
| {
| return new TestBean();
| }
|
|
| public class TestBean
| {
| private String[] value;
|
| public TestBean()
| {
| value = new String[] {"aa", "bb"};
| }
|
| public String[] getValue()
| {
| return value;
| }
|
| public void setValue(String[] value)
| {
| this.value = value;
| }
| }
|
As you can see the value property always returns a two field array. Then we use
a wscompile tool to generate a WSDL (complete WSDL printout can be found at the
bottom of the message) which is provided in the deployment. However the service
response never contains the contents of the "value" array. This happened for
all array properties of all Java beans we have used in the WS response. For
some reason this problem doesn't affect service methods that has an array as
their return type (i.e. the array is not nested inside a bean).
The response for this service is as follows, the "value" property is empty:
<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'
| xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/'>
| <env:Header></env:Header>
| <env:Body>
| <tns:testWSResponse
xmlns:tns='http://www.berit.com/wsdl/WorkspaceManager'
|
env:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
| <result xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
| <value></value>
| </result>
| </tns:testWSResponse>
| </env:Body>
| </env:Envelope>
|
Do you have any ideas what may cause this? I tried the same web service on Sun
JSAS 8.2 and Oracle OC4J 10.1.3.3 and both worked fine, only JBoss didn't.
Any help will be appreciated, thanks.
P.S.: The WSDL printout:
<?xml version="1.0" encoding="UTF-8"?>
| <definitions name="TestWSEndPoint"
| targetNamespace="http://www.berit.com/wsdl/TestWS"
| xmlns:tns="http://www.berit.com/wsdl/TestWS"
| xmlns="http://schemas.xmlsoap.org/wsdl/"
| xmlns:xsd="http://www.w3.org/2001/XMLSchema"
| xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
| <types>
| <schema targetNamespace="http://www.berit.com/wsdl/TestWS"
| xmlns:tns="http://www.berit.com/wsdl/TestWS"
| xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
| xmlns="http://www.w3.org/2001/XMLSchema">
| <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
| <complexType name="TestBean">
| <sequence>
| <element name="val" type="tns:ArrayOfstring"/>
| </sequence>
| </complexType>
| <complexType name="ArrayOfstring">
| <complexContent>
| <restriction base="soap11-enc:Array">
| <attribute ref="soap11-enc:arrayType"
wsdl:arrayType="string[]"/>
| </restriction>
| </complexContent>
| </complexType>
| </schema>
| </types>
| <message name="TestWS_testWS"/>
| <message name="TestWS_testWSResponse">
| <part name="result" type="tns:TestBean"/>
| </message>
| <portType name="TestWS">
| <operation name="testWS">
| <input message="tns:TestWS_testWS"/>
| <output message="tns:TestWS_testWSResponse"/>
| </operation>
| </portType>
| <binding name="TestWSBinding" type="tns:TestWS">
| <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc"/>
| <operation name="testWS">
| <soap:operation soapAction=""/>
| <input>
| <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
| use="encoded"
| namespace="http://www.berit.com/wsdl/TestWS"/>
| </input>
| <output>
| <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
| use="encoded"
| namespace="http://www.berit.com/wsdl/TestWS"/>
| </output>
| </operation>
| </binding>
| <service name="TestWSEndPoint">
| <port name="TestWSPort" binding="tns:TestWSBinding">
| <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
| </port>
| </service>
| </definitions>
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113405#4113405
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4113405
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user