Please provide your WSDD.
Anne
On Dec 27, 2007 8:02 AM, Sergey Bykov <[EMAIL PROTECTED]> wrote:
>
> I built a very simple test service the main goal is to return my custom bean
> as a result in wrapped/literal style.
> This is service:
> IArray.java
>
> package service;
>
> public interface IArray {
> public ComplexType method();
> }
>
> ArrayService.java
>
> package service;
>
> public class ArrayService implements IArray{
> public ComplexType method(){
> ComplexType complexType = new ComplexType();
> complexType.setProp1("value21");
> complexType.setProp2("value22");
> return complexType;
> }
> }
>
> This is complex type definition:
> ComplexType.java
>
> package service;
>
> public class ComplexType {
> private String prop1;
> private String prop2;
>
> public String getProp1() {
> return prop1;
> }
>
> public void setProp1(String prop1) {
> this.prop1 = prop1;
> }
>
> public String getProp2() {
> return prop2;
> }
>
> public void setProp2(String prop2) {
> this.prop2 = prop2;
> }
> }
> WSDL on the server:
>
> <?xml version="1.0" encoding="UTF-8" ?>
> - <wsdl:definitions targetNamespace="http://service"
> xmlns:apachesoap="http://xml.apache.org/xml-soap"
> xmlns:impl="http://service" xmlns:intf="http://service"
> 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.4
> Built on Apr 22, 2006 (06:55:48 PDT)
>
> -->
> - <wsdl:types>
> - <schema elementFormDefault="qualified" targetNamespace="http://service"
> xmlns="http://www.w3.org/2001/XMLSchema">
> - <element name="method">
> <complexType />
> </element>
> - <element name="methodResponse">
> - <complexType>
> - <sequence>
> <element name="methodReturn" type="impl:ComplexType" />
> </sequence>
> </complexType>
> </element>
> - <complexType name="ComplexType">
> - <sequence>
> <element name="prop1" nillable="true" type="xsd:string" />
> <element name="prop2" nillable="true" type="xsd:string" />
> </sequence>
> </complexType>
> </schema>
> </wsdl:types>
> - <wsdl:message name="methodRequest">
> <wsdl:part element="impl:method" name="parameters" />
> </wsdl:message>
> - <wsdl:message name="methodResponse">
> <wsdl:part element="impl:methodResponse" name="parameters" />
> </wsdl:message>
> - <wsdl:portType name="IArray">
> - <wsdl:operation name="method">
> <wsdl:input message="impl:methodRequest" name="methodRequest" />
> <wsdl:output message="impl:methodResponse" name="methodResponse" />
> </wsdl:operation>
> </wsdl:portType>
> - <wsdl:binding name="ArrayServiceSoapBinding" type="impl:IArray">
> <wsdlsoap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" />
> - <wsdl:operation name="method">
> <wsdlsoap:operation soapAction="" />
> - <wsdl:input name="methodRequest">
> <wsdlsoap:body use="literal" />
> </wsdl:input>
> - <wsdl:output name="methodResponse">
> <wsdlsoap:body use="literal" />
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> - <wsdl:service name="IArrayService">
> - <wsdl:port binding="impl:ArrayServiceSoapBinding" name="ArrayService">
> <wsdlsoap:address
> location="http://localhost:8080/axis/services/ArrayService" />
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> And here is client:
> Client.java
>
> package client;
>
> import org.apache.axis.client.Call;
> import org.apache.axis.client.Service;
> import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
> import org.apache.axis.encoding.ser.ArraySerializerFactory;
> import service.ComplexType;
>
> import javax.xml.namespace.QName;
> import java.util.ArrayList;
>
> public class Client {
>
> public static void main(String[] args){
> try {
> Service service = new Service();
> Call call = (Call) service.createCall();
>
> call.setTargetEndpointAddress("http://localhost:8080/axis/services/ArrayService");
> call.setOperationName("method");
> QName complexTypeQName = new
> QName("http://service","ComplexType");
> call.registerTypeMapping(ComplexType.class,
> complexTypeQName,
> new
> org.apache.axis.encoding.ser.BeanSerializerFactory
> (ComplexType.class,complexTypeQName),
> new
> org.apache.axis.encoding.ser.BeanDeserializerFactory(ComplexType.class,complexTypeQName));
> call.setOperationStyle("wrapped");
> call.setOperationUse("literal");
> call.setReturnType(complexTypeQName, ComplexType.class);
> ComplexType complexType = (ComplexType) call.invoke(new
> Object[0]);
> }
> catch (Exception e) {
> e.printStackTrace();
> }
>
> }
> }
>
> This service is extreamly simple, but I got the following problem: axis
> client can't parse result correctly. I get the following SOAP response:
> <?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:Body>
> <methodResponse xmlns="">
> <ns1:methodReturn xmlns:ns1="http://service">
> <ns1:prop1>value21</ns1:prop1>
> <ns1:prop2>value22</ns1:prop2>
> </ns1:methodReturn>
> </methodResponse>
> </soapenv:Body>
> </soapenv:Envelope>
> and during parsing this complex type axis throws exeption:
> org.xml.sax.SAXException: Deserializing parameter 'methodReturn': could not
> find deserializer for type {http://service}ComplexType
> at
> org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
> at
> org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
> at
> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
> at
> org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
> at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
> at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
> at org.apache.axis.client.Call.invoke(Call.java:2467)
> at org.apache.axis.client.Call.invoke(Call.java:2366)
> at org.apache.axis.client.Call.invoke(Call.java:1812)
> at client.Client.main(Client.java:34)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>
> What is missed in this simple scenario? (Also, if I change the style to rpc
> everything becomes working)
>
>
> --
> View this message in context:
> http://www.nabble.com/Return-complex-type-in-wrapped-literal-style.-tp14512578p14512578.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]