On 20/07/2011 14:49, Antonio De Berardis wrote:
The Wsdl generated by Tuscany is:
<wsdl:definitions name="CrmServiceService" targetNamespace="http://interfaces/">
<wsdl:types>
<xs:schema targetNamespace="http://jaxb.dev.java.net/array" version="1.0">
<xs:complexType
final="#all" name="stringArray"> <xs:sequence> <xs:element maxOccurs="unbounded"
minOccurs="0"
name="item" nillable="true" type="xs:string"/> </xs:sequence> </xs:complexType>
</xs:schema>
<xs:schema attributeFormDefault="qualified" elementFormDefault="unqualified"
targetNamespace="http://interfaces/"> <xs:element name="test"> <xs:complexType>
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="arg0" nillable="true"
type="xs:string"/>
</xs:sequence> </xs:complexType> </xs:element> <xs:element name="testResponse">
<xs:complexType/>
</xs:element> </xs:schema> </wsdl:types> <wsdl:message name="test"> <wsdl:part
name="test"
element="test"> </wsdl:part> </wsdl:message> <wsdl:message name="testResponse">
<wsdl:part
name="testResponse" element="testResponse"> </wsdl:part> </wsdl:message>
<wsdl:portType
name="CrmService"> <wsdl:operation name="test"> <wsdl:input message="test">
</wsdl:input>
<wsdl:output message="testResponse"> </wsdl:output> </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CrmServiceBinding" type="CrmService"> <SOAP:binding
style="document"
transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="test">
<SOAP:operation/>
<wsdl:input> <SOAP:body use="literal"/> </wsdl:input> <wsdl:output> <SOAP:body
use="literal"/>
</wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="CrmService">
<wsdl:port
name="CrmServiceSOAP11Port" binding="CrmServiceBinding"> <SOAP:address
location="http://localhost:8087/CrmComponent/CrmService"/> </wsdl:port>
</wsdl:service>
</wsdl:definitions>
I use eclipse to generate the web service client and a simple call to the
service cause the exception
public static void main(String[] args) {
CrmServiceProxy p=new CrmServiceProxy();
String [] stringArray=new String[2];
stringArray[0]="a";
stringArray[1]="b";
try {
p.test(stringArray);
} catch (RemoteException e) {
e.printStackTrace();
}
}
Antonio,
Thanks for sending that material.
The WSDL is curious and I suspect there is a Tuscany bug here somewhere.
The WSDL PortType has a single operation "test" with an input message "test".
The "test" input message is of type <test> - and the <test/> element is then declared as a complex
type which is a sequence of <arg0/> elements, each of which are of type xs:string.
However, I note that the WSDL defines a complex type called "stringArray", which is a sequence of
<item/> elements of type xs:string.
I strongly suspect that the <test/> element SHOULD have a single <arg0/> element of type
"stringArray" - otherwise why define the stringArray type at all.
Certainly, the WSDL is telling the binding code to expect a string rather than a stringArray, which
is very likely going to cause the problem you see when you call the service.
Since the WSDL is being generated by Tuscany, you can't just change the WSDL to
fix this.
It may be that you can add some JAXB annotations to the service interface to get around this problem
- by making it explicit to JAXB the WSDL <-> Java behaviour you are expecting.
Yours, Mike.