This page was created to explain the using of ArrayDeserializer in Web Services.
Here is a sample for the definition of a Web Service with a method using Array of String.
A method String[] get4xHelloWorld() has been defined to return an array of String containing 4 string for a Hello World in 4 languages. The definition of the WSDD file seems to be correct, the client java file are correctly generated with the tool WSDL2Java from Axis, and the server returns a SOAP message coresponding to the answer to the request with the 4 languages in an array. But the client can't find a good deserializer.
If you have an answer for this problem, you can modified this page to identify the correct definition of this sample. NB : This seems not be a problem with the version of Axis or woth the Weblogic server.
Informations :
- - Server : BEA Weblogic 8.1 SP2 - Axis Server-Side : Axis 1.2 Beta2 - Axis Client-Side : Axis 1.2 Beta2
Thanks for the users of this sample.
WSDD-Server Definition
<service name="WSTester" provider="java:RPC" style="wrapped" >
<namespace>http://myNamespace.com</namespace> <parameter name="className" value="...WebServiceImpl"/> <parameter name="allowedMethods" value="get4xHelloWorld"/>
<typeMapping qname="myNSJava:ArrayOf_string"
- type="java:java.lang.String[]"
serializer="org.apache.axis.encoding.ser.ArraySerializerFactory" deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory" encodingStyle=""/>
- type="java:java.lang.String[]"
</service>
WSDL File
<element name="get4xHelloWorld">
<complexType/>
</element> ... <element name="get4xHelloWorldResponse">
<complexType>
<sequence>
<element maxOccurs="unbounded" name="get4xHelloWorldReturn" type="xsd:string"/>
</sequence>
</complexType>
</element> ... <wsdl:message name="get4xHelloWorldRequest">
<wsdl:part element="impl:get4xHelloWorld" name="parameters"/>
</wsdl:message> ... <wsdl:message name="get4xHelloWorldResponse">
<wsdl:part element="impl:get4xHelloWorldResponse" name="parameters"/>
</wsdl:message> ... <wsdl:operation name="get4xHelloWorld">
<wsdl:input message="impl:get4xHelloWorldRequest" name="get4xHelloWorldRequest"/> <wsdl:output message="impl:get4xHelloWorldResponse" name="get4xHelloWorldResponse"/>
</wsdl:operation> ... <wsdl:operation name="get4xHelloWorld">
<wsdlsoap:operation soapAction=""/> <wsdl:input name="get4xHelloWorldRequest">
<wsdlsoap:body namespace="http://myNamespace.com/service" use="literal"/>
</wsdl:input> <wsdl:output name="get4xHelloWorldResponse">
<wsdlsoap:body namespace="http://myNamespace.com/service" use="literal"/>
</wsdl:output>
</wsdl:operation>
SOAP RESPONSE MESSAGE
HTTP/1.1 200 OK Date: Thu, 03 Feb 2005 15:20:18 GMT Server: WebLogic Server 8.1 SP2 Fri Dec 5 15:01:51 PST 2003 316284 Content-Type: text/xml; charset=utf-8 Connection: Close <?xml version="1.0" encoding="utf-8"?> <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:Header> </soapenv:Header> <soapenv:Body>
<get4xHelloWorldResponse xmlns="http://myNamespace.com/service">
<get4xHelloWorldReturn xsi:type="ns2:ArrayOfstring" xmlns:ns2="http://myNamespace.com/java">
<item xsi:type="xsd:string" xmlns="">Hello World</item> <item xsi:type="xsd:string" xmlns="">Bonjour Monde</item> <item xsi:type="xsd:string" xmlns="">Guten Tag Welt</item> <item xsi:type="xsd:string" xmlns="">Buongiorno Mondo</item>
</get4xHelloWorldReturn>
</get4xHelloWorldResponse>
</soapenv:Body>
</soapenv:Envelope>
WSDD-Client Definition
<?xml version="1.0" encoding="UTF-8"?> <deployment name="wbsclient"
xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:handler="http://xml.apache.org/axis/wsdd/providers/handler">
<globalConfiguration> </globalConfiguration>
<transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender"/> <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender">
<requestFlow> </requestFlow> <responseFlow> </responseFlow>
</transport>
<transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender"/>
</deployment>
Error Message
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: org.xml.sax.SAXException: Deserializing parameter 'get4xHelloWorldReturn': could not find deserializer for type {http://www.extranet.rtc.ch/java}ArrayOf_string faultActor: faultNode: faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Deserializing parameter 'get4xHelloWorldReturn': could not find deserializer for type {http://www.extranet.rtc.ch/java}ArrayOf_string at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:269) at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1001) at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:159) at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1050) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:196) at org.apache.axis.message.RPCElement.getParams(RPCElement.java:310) at org.apache.axis.client.Call.invoke(Call.java:2381) at org.apache.axis.client.Call.invoke(Call.java:2280) at org.apache.axis.client.Call.invoke(Call.java:1741)