1 Reply Latest reply on Oct 7, 2005 4:37 PM by Alejandro Guizar

    Dynamic Proxy Client Using Complex Types

    Duane Homick Newbie

      I have a document-literal webservice that I hope to talk to via a dynamic proxy. I have generated the client objects using the wscompile tool, but I when I send a request using a complex type, I get a error:

      Caused by: java.io.IOException: No serializer found for class org.jboss.test.web
      service.samples.AddRequest in registry org.jboss.axis.encoding.TypeMappingImpl@9
      300c

      I don't see anywhere where I can tell the client code how to serialize that object. Am I missing something?


      wsdl:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <definitions name="OrganizationService"
       targetNamespace="http://org.jboss.test.webservice/samples"
       xmlns:tns="http://org.jboss.test.webservice/samples"
       xmlns="http://schemas.xmlsoap.org/wsdl/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
       <types>
       <xsd:schema targetNamespace="http://org.jboss.test.webservice/samples"
       xmlns:tns="http://org.jboss.test.webservice/samples"
       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"
       elementFormDefault="unqualified"
       attributeFormDefault="unqualified">
      
       <!-- Define general elements -->
       <xsd:element name="ApplicationId" type="xsd:string"/>
       <xsd:element name="ServerId" type="xsd:string"/>
       <xsd:element name="RequestId" type="xsd:string"/>
       <xsd:element name="Locale" type="xsd:string"/>
       <xsd:element name="Timezone" type="xsd:string"/>
       <xsd:element name="RequestProcessingTime" type="xsd:double"/>
       <xsd:element name="Result">
       <xsd:simpleType>
       <xsd:restriction base="xsd:string">
       <xsd:enumeration value="Success"/>
       <xsd:enumeration value="Failure"/>
       </xsd:restriction>
       </xsd:simpleType>
       </xsd:element>
       <xsd:element name="Error">
       <xsd:complexType>
       <xsd:sequence>
       <xsd:element name="ErrorCode" type="xsd:int"/>
       <xsd:element name="ErrorMessage" type="xsd:string"/>
       </xsd:sequence>
       </xsd:complexType>
       </xsd:element>
       <xsd:element name="Errors">
       <xsd:complexType>
       <xsd:sequence>
       <xsd:element ref="tns:Error" minOccurs="0" maxOccurs="unbounded"/>
       </xsd:sequence>
       </xsd:complexType>
       </xsd:element>
      
       <xsd:complexType name="OperationRequest">
       <xsd:sequence>
       <xsd:element ref="tns:ApplicationId"/>
       <xsd:element ref="tns:Locale" minOccurs="0"/>
       <xsd:element ref="tns:Timezone" minOccurs="0"/>
       </xsd:sequence>
       </xsd:complexType>
      
       <xsd:complexType name="OperationResponse">
       <xsd:sequence>
       <xsd:element ref="tns:ApplicationId"/>
       <xsd:element ref="tns:ServerId"/>
       <xsd:element ref="tns:RequestId"/>
       <xsd:element ref="tns:RequestProcessingTime"/>
       <xsd:element ref="tns:Locale" minOccurs="0"/>
       <xsd:element ref="tns:Timezone" minOccurs="0"/>
       <xsd:element ref="tns:Result"/>
       <xsd:element ref="tns:Errors"/>
       </xsd:sequence>
       </xsd:complexType>
      
       <!-- Define Objects -->
       <xsd:complexType name="Person">
       <xsd:sequence>
       <xsd:element name="Name" type="xsd:string"/>
       <xsd:element name="Age" type="xsd:int"/>
       </xsd:sequence>
       </xsd:complexType>
      
       <!-- Define requests -->
       <xsd:complexType name="AddRequestPayload">
       <xsd:sequence>
       <xsd:element name="x" type="xsd:int"/>
       <xsd:element name="y" type="xsd:int"/>
       </xsd:sequence>
       </xsd:complexType>
       <xsd:element name="AddRequest">
       <xsd:complexType>
       <xsd:sequence>
       <xsd:element name="RequestInfo" type="tns:OperationRequest" minOccurs="1"/>
       <xsd:element name="Request" type="tns:AddRequestPayload" minOccurs="1"/>
       </xsd:sequence>
       </xsd:complexType>
       </xsd:element>
      
       <!-- Define responses -->
       <xsd:complexType name="AddResponsePayload">
       <xsd:sequence>
       <xsd:element name="result" type="xsd:int"/>
       </xsd:sequence>
       </xsd:complexType>
       <xsd:element name="AddResponse">
       <xsd:complexType>
       <xsd:sequence>
       <xsd:element name="ResponseInfo" type="tns:OperationResponse" minOccurs="1"/>
       <xsd:element name="Response" type="tns:AddResponsePayload" minOccurs="1"/>
       </xsd:sequence>
       </xsd:complexType>
       </xsd:element>
      
       </xsd:schema>
       </types>
      
       <message name="AddResponseMsg">
       <part name="parameters" element="tns:AddResponse"/>
       </message>
       <message name="AddRequestMsg">
       <part name="result" element="tns:AddRequest"/>
       </message>
      
       <portType name="Organization">
       <operation name="add">
       <input message="tns:AddRequestMsg"/>
       <output message="tns:AddResponseMsg"/>
       </operation>
       </portType>
      
       <binding name="OrganizationBinding" type="tns:Organization">
       <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
       <operation name="add">
       <soap:operation soapAction=""/>
       <input>
       <soap:body use="literal" namespace="http://org.jboss.test.webservice/samples"/>
       </input>
       <output>
       <soap:body use="literal" namespace="http://org.jboss.test.webservice/samples"/>
       </output>
       </operation>
       </binding>
      
       <service name="OrganizationService">
       <port name="OrganizationPort" binding="tns:OrganizationBinding">
       <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
       </port>
       </service>
      
      </definitions>
      



      rpc-mapping:
      
      <?xml version="1.0" encoding="UTF-8"?>
      <java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
      <package-mapping>
      <package-type>org.jboss.test.webservice.samples</package-type>
      <namespaceURI>http://org.jboss.test.webservice/samples</namespaceURI>
      </package-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.Errors</java-type>
      <anonymous-type-qname>http://org.jboss.test.webservice/samples:&gt;OperationResponse&gt;Errors</anonymous-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>error</java-variable-name>
      <xml-element-name>Error</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.AddResponse</java-type>
      <anonymous-type-qname>http://org.jboss.test.webservice/samples:&gt;AddResponse</anonymous-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>responseInfo</java-variable-name>
      <xml-element-name>ResponseInfo</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>response</java-variable-name>
      <xml-element-name>Response</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.AddRequest</java-type>
      <anonymous-type-qname>http://org.jboss.test.webservice/samples:&gt;AddRequest</anonymous-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>requestInfo</java-variable-name>
      <xml-element-name>RequestInfo</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>request</java-variable-name>
      <xml-element-name>Request</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.AddRequestPayload</java-type>
      <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples">typeNS:AddRequestPayload</root-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>x</java-variable-name>
      <xml-element-name>x</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>y</java-variable-name>
      <xml-element-name>y</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.Error</java-type>
      <anonymous-type-qname>http://org.jboss.test.webservice/samples:&gt;&gt;OperationResponse&gt;Errors&gt;Error</anonymous-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>errorCode</java-variable-name>
      <xml-element-name>ErrorCode</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>errorMessage</java-variable-name>
      <xml-element-name>ErrorMessage</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.OperationRequest</java-type>
      <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples">typeNS:OperationRequest</root-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>applicationId</java-variable-name>
      <xml-element-name>ApplicationId</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>locale</java-variable-name>
      <xml-element-name>Locale</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>timezone</java-variable-name>
      <xml-element-name>Timezone</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.AddResponsePayload</java-type>
      <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples">typeNS:AddResponsePayload</root-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>result</java-variable-name>
      <xml-element-name>result</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.OperationResponse</java-type>
      <root-type-qname xmlns:typeNS="http://org.jboss.test.webservice/samples">typeNS:OperationResponse</root-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>applicationId</java-variable-name>
      <xml-element-name>ApplicationId</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>serverId</java-variable-name>
      <xml-element-name>ServerId</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>requestId</java-variable-name>
      <xml-element-name>RequestId</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>requestProcessingTime</java-variable-name>
      <xml-element-name>RequestProcessingTime</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>locale</java-variable-name>
      <xml-element-name>Locale</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>timezone</java-variable-name>
      <xml-element-name>Timezone</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>result</java-variable-name>
      <xml-element-name>Result</xml-element-name>
      </variable-mapping>
      <variable-mapping>
      <java-variable-name>errors</java-variable-name>
      <xml-element-name>Errors</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.Error[]</java-type>
      <anonymous-type-qname>http://org.jboss.test.webservice/samples:&gt;OperationResponse&gt;Errors&gt;Error[0,unbounded]</anonymous-type-qname>
      <qname-scope>complexType</qname-scope>
      </java-xml-type-mapping>
      <java-xml-type-mapping>
      <java-type>org.jboss.test.webservice.samples.Result</java-type>
      <anonymous-type-qname>http://org.jboss.test.webservice/samples:&gt;OperationResponse&gt;Result</anonymous-type-qname>
      <qname-scope>simpleType</qname-scope>
      </java-xml-type-mapping>
      <service-interface-mapping>
      <service-interface>org.jboss.test.webservice.samples.OrganizationService</service-interface>
      <wsdl-service-name xmlns:serviceNS="http://org.jboss.test.webservice/samples">serviceNS:OrganizationService</wsdl-service-name>
      <port-mapping>
      <port-name>OrganizationPort</port-name>
      <java-port-name>OrganizationPort</java-port-name>
      </port-mapping>
      </service-interface-mapping>
      <service-endpoint-interface-mapping>
      <service-endpoint-interface>org.jboss.test.webservice.samples.Organization</service-endpoint-interface>
      <wsdl-port-type xmlns:portTypeNS="http://org.jboss.test.webservice/samples">portTypeNS:Organization</wsdl-port-type>
      <wsdl-binding xmlns:bindingNS="http://org.jboss.test.webservice/samples">bindingNS:OrganizationBinding</wsdl-binding>
      <service-endpoint-method-mapping>
      <java-method-name>add</java-method-name>
      <wsdl-operation>add</wsdl-operation>
      <method-param-parts-mapping>
      <param-position>0</param-position>
      <param-type>org.jboss.test.webservice.samples.AddRequest</param-type>
      <wsdl-message-mapping>
      <wsdl-message xmlns:wsdlMsgNS="http://org.jboss.test.webservice/samples">wsdlMsgNS:AddRequestMsg</wsdl-message>
      <wsdl-message-part-name>result</wsdl-message-part-name>
      <parameter-mode>IN</parameter-mode>
      </wsdl-message-mapping>
      </method-param-parts-mapping>
      <wsdl-return-value-mapping>
      <method-return-value>org.jboss.test.webservice.samples.AddResponse</method-return-value>
      <wsdl-message xmlns:wsdlMsgNS="http://org.jboss.test.webservice/samples">wsdlMsgNS:AddResponseMsg</wsdl-message>
      <wsdl-message-part-name>parameters</wsdl-message-part-name>
      </wsdl-return-value-mapping>
      </service-endpoint-method-mapping>
      </service-endpoint-interface-mapping>
      </java-wsdl-mapping>
      
      



      wscompile:
       <exec executable="wscompile.bat">
       <arg line="-f:documentliteral"/>
       <arg line="-f:wsi"/>
       <arg line="-s '${src}/java'"/>
       <arg line="-keep"/>
       <arg line="-import"/>
       <arg line="-mapping '${src}/resources/WEB-INF/jaxrpc-mapping.xml'"/>
       <arg line="'${src}/resources/wscompile-config.xml'"/>
       </exec>
      



      The client is a servlet that accesses the service as so:
       String urlstr = "http://dhomick-pc1:8080/simple-service/Organization?wsdl";
      
       URL url = new URL(urlstr);
      
       QName qname = new QName("http://org.jboss.test.webservice/samples",
       "OrganizationService");
      
       System.out.println("here0");
       ServiceFactory factory = ServiceFactory.newInstance();
       Service service = factory.createService(url, qname);
      
       System.out.println("here1");
       Organization organization = (Organization) service.getPort(Organization.class);
       System.out.println("here2");
       for (int i = 0; i < 1; i++)
       {
       AddRequest request = new AddRequest();
       request.setRequest(new AddRequestPayload(1, 2));
       request.setRequestInfo(new OperationRequest());
      
       AddResponse response = organization.add(request);
      
       System.out.println("Response: " + response.getResponse().getResult());
       }
      
      




      Anyone know what I am missing?