Desrialisation error using document-literal and operation with arrays [message #172154] |
Thu, 22 June 2006 22:01 |
Eclipse User |
|
|
|
Originally posted by: john.pailing.screwfix.com
Please forgive me if I don't supply enough info or have missed something
but I'm very new to this and I am just beginning to explore WPT and Web
Services.
I am using WPT 1.0.2 to create a bottom up web service. It has sucessfuly
worked for all the operations that take simple types. However I have one
operation which takes a complex type. When I try to test this operation
using the Web Services Explorer I get the following error
soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>org.xml.sax.SAXException: SimpleDeserializer encountered a
child element, which is NOT expected, in something it was trying to
deserialize.</faultstring>
- <detail>
<ns1:hostname
xmlns:ns1="http://xml.apache.org/axis/">PC008594</ns1:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soap
The complex type is defined as follows
public class Person {
public String title;
public String firstName;
public String surname;
public String friends[];
}
And the Operation is defined as
public void sayHelloToPerson(Person person)
This only happens if I use document-Literal-Wrapped. If I use RPC-Encoded
then this works and I don't get the error. However I have been told I
need to use document literal in order to make my service interopable.
My WSDL is as follows.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://DefaultNamespace"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://DefaultNamespace" xmlns:intf="http://DefaultNamespace"
xmlns:tns1="http://vo" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2.1
Built on Jun 14, 2005 (09:15:57 EDT)-->
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="http://DefaultNamespace"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://vo"/>
<element name="sayHello">
<complexType/>
</element>
<element name="sayHelloResponse">
<complexType/>
</element>
<element name="sayGoodbye">
<complexType/>
</element>
<element name="sayGoodbyeResponse">
<complexType/>
</element>
<element name="sayHelloTo">
<complexType>
<sequence>
<element name="name" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="sayHelloToResponse">
<complexType/>
</element>
<element name="sayHelloToPerson">
<complexType>
<sequence>
<element name="person" type="tns1:Person"/>
</sequence>
</complexType>
</element>
<complexType name="ArrayOf_xsd_string">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item"
type="xsd:string"/>
</sequence>
</complexType>
<element name="sayHelloToPersonResponse">
<complexType/>
</element>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://vo"
xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://DefaultNamespace"/>
<complexType name="Person">
<sequence>
<element name="title" nillable="true" type="xsd:string"/>
<element name="firstName" nillable="true" type="xsd:string"/>
<element name="surname" nillable="true" type="xsd:string"/>
<element name="friends" nillable="true"
type="impl:ArrayOf_xsd_string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="sayHelloToRequest">
<wsdl:part element="impl:sayHelloTo" name="parameters"/>
</wsdl:message>
<wsdl:message name="sayHelloResponse">
<wsdl:part element="impl:sayHelloResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="sayHelloToResponse">
<wsdl:part element="impl:sayHelloToResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="sayHelloToPersonRequest">
<wsdl:part element="impl:sayHelloToPerson" name="parameters"/>
</wsdl:message>
<wsdl:message name="sayHelloRequest">
<wsdl:part element="impl:sayHello" name="parameters"/>
</wsdl:message>
<wsdl:message name="sayHelloToPersonResponse">
<wsdl:part element="impl:sayHelloToPersonResponse"
name="parameters"/>
</wsdl:message>
<wsdl:message name="sayGoodbyeRequest">
<wsdl:part element="impl:sayGoodbye" name="parameters"/>
</wsdl:message>
<wsdl:message name="sayGoodbyeResponse">
<wsdl:part element="impl:sayGoodbyeResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="HelloWorld">
<wsdl:operation name="sayHello">
<wsdl:input message="impl:sayHelloRequest"
name="sayHelloRequest"/>
<wsdl:output message="impl:sayHelloResponse"
name="sayHelloResponse"/>
</wsdl:operation>
<wsdl:operation name="sayGoodbye">
<wsdl:input message="impl:sayGoodbyeRequest"
name="sayGoodbyeRequest"/>
<wsdl:output message="impl:sayGoodbyeResponse"
name="sayGoodbyeResponse"/>
</wsdl:operation>
<wsdl:operation name="sayHelloTo">
<wsdl:input message="impl:sayHelloToRequest"
name="sayHelloToRequest"/>
<wsdl:output message="impl:sayHelloToResponse"
name="sayHelloToResponse"/>
</wsdl:operation>
<wsdl:operation name="sayHelloToPerson">
<wsdl:input message="impl:sayHelloToPersonRequest"
name="sayHelloToPersonRequest"/>
<wsdl:output message="impl:sayHelloToPersonResponse"
name="sayHelloToPersonResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldSoapBinding" type="impl:HelloWorld">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="sayGoodbye">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayGoodbyeRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayGoodbyeResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="sayHelloTo">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloToRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloToResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="sayHelloToPerson">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayHelloToPersonRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="sayHelloToPersonResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port binding="impl:HelloWorldSoapBinding" name="HelloWorld">
<wsdlsoap:address
location="http://localhost/TestWebService/services/HelloWorld"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02800 seconds