6 Replies Latest reply on Jan 12, 2006 7:48 AM by thomas.diesler

    JAX-RPC HELP!!  "could not find deserializer for type"

    rkite01

      I have read and read and tried many suggestions from other posts but I can not find a solution to this. I have tried JBoss 4.0.1 and 4.0.3. My example works fine passing String values in and out but I can not return a String[] type back. I have tried wrapping the String[] in another object and tried the generated wrapper from wscompile. I am using the jaxrpc jars jwsdp-1.6 from Sun in the jboss/server/default/lib directory. The wdsl file is generated with wscompile. It seems to have everything it needs other than the correct deserializer. I know several others are having this problem and have read and tried several solutions.

      Thanks


      WDSL

      <?xml version="1.0" encoding="UTF-8"?>

      <definitions name="HelloService" targetNamespace="http://mil.tis.demo/" xmlns:tns="http://mil.tis.demo/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns2="http://mil.tis.demo.types/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

      <schema targetNamespace="http://mil.tis.demo.types/" xmlns:tns="http://mil.tis.demo.types/" 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">
























      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>

      <soap:operation soapAction=""/>

      <soap:body use="literal" namespace="http://mil.tis.demo/"/>

      <soap:body use="literal" namespace="http://mil.tis.demo/"/>

      <soap:operation soapAction=""/>

      <soap:body use="literal" namespace="http://mil.tis.demo/"/>

      <soap:body use="literal" namespace="http://mil.tis.demo/"/>

      <soap:operation soapAction=""/>

      <soap:body use="literal" namespace="http://mil.tis.demo/"/>

      <soap:body use="literal" namespace="http://mil.tis.demo/"/>


      <soap:address location="REPLACE_WITH_ACTUAL_URL"/>


      mapping.xml

      <?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>mil.tis.demo</package-type>
      http://mil.tis.demo.types/
      </package-mapping>
      <package-mapping>
      <package-type>mil.tis.demo</package-type>
      http://mil.tis.demo/
      </package-mapping>

      <java-xml-type-mapping>
      <java-type>mil.tis.demo.types.StringArray</java-type>
      <root-type-qname xmlns:typeNS="http://mil.tis.demo.types/">typeNS:StringArray</root-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>value</java-variable-name>
      <xml-element-name>value</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>

      <service-interface-mapping>
      <service-interface>mil.tis.demo.HelloService</service-interface>
      <wsdl-service-name xmlns:serviceNS="http://mil.tis.demo/">serviceNS:HelloService</wsdl-service-name>
      <port-mapping>
      <port-name>HelloPort</port-name>
      <java-port-name>HelloPort</java-port-name>
      </port-mapping>
      </service-interface-mapping>
      <service-endpoint-interface-mapping>
      <service-endpoint-interface>mil.tis.demo.Hello</service-endpoint-interface>
      <wsdl-port-type xmlns:portTypeNS="http://mil.tis.demo/">portTypeNS:Hello</wsdl-port-type>
      <wsdl-binding xmlns:bindingNS="http://mil.tis.demo/">bindingNS:HelloBinding</wsdl-binding>
      <service-endpoint-method-mapping>
      <java-method-name>getText</java-method-name>
      <wsdl-operation>getText</wsdl-operation>
      <wsdl-return-value-mapping>
      <method-return-value>java.lang.String</method-return-value>
      <wsdl-message xmlns:wsdlMsgNS="http://mil.tis.demo/">wsdlMsgNS:Hello_getTextResponse</wsdl-message>
      <wsdl-message-part-name>result</wsdl-message-part-name>
      </wsdl-return-value-mapping>
      </service-endpoint-method-mapping>
      <service-endpoint-method-mapping>
      <java-method-name>getUics</java-method-name>
      <wsdl-operation>getUics</wsdl-operation>
      <wsdl-return-value-mapping>
      <method-return-value>mil.tis.demo.types.StringArray</method-return-value>
      <wsdl-message xmlns:wsdlMsgNS="http://mil.tis.demo/">wsdlMsgNS:Hello_getUicsResponse</wsdl-message>
      <wsdl-message-part-name>result</wsdl-message-part-name>
      </wsdl-return-value-mapping>
      </service-endpoint-method-mapping>
      <service-endpoint-method-mapping>
      <java-method-name>hello</java-method-name>
      <wsdl-operation>hello</wsdl-operation>
      <method-param-parts-mapping>
      <param-position>0</param-position>
      <param-type>java.lang.String</param-type>
      <wsdl-message-mapping>
      <wsdl-message xmlns:wsdlMsgNS="http://mil.tis.demo/">wsdlMsgNS:Hello_hello</wsdl-message>
      <wsdl-message-part-name>String_1</wsdl-message-part-name>
      <parameter-mode>IN</parameter-mode>
      </wsdl-message-mapping>
      </method-param-parts-mapping>
      <wsdl-return-value-mapping>
      <method-return-value>java.lang.String</method-return-value>
      <wsdl-message xmlns:wsdlMsgNS="http://mil.tis.demo/">wsdlMsgNS:Hello_helloResponse</wsdl-message>
      <wsdl-message-part-name>result</wsdl-message-part-name>
      </wsdl-return-value-mapping>
      </service-endpoint-method-mapping>
      </service-endpoint-interface-mapping>
      </java-wsdl-mapping>


      Here is the server class HelloServlet.java

      package mil.tis.demo;

      import mil.tis.demo.types.StringArray;

      public class HelloServlet
      {
      public String hello(String name){
      return("Hello " + name);
      }

      public StringArray getUics()
      {
      String[] stringArray = {"WWWWWW", "WWWWWG", "WWWWWH"};
      StringArray result = new StringArray();
      result.setValue(stringArray);
      return(result);
      }

      public String getText() { return("Be quiet Cliff"); }
      }

      The remove interface Hello.java

      package mil.tis.demo;

      import java.rmi.RemoteException;
      import java.rmi.Remote;
      import mil.tis.demo.types.StringArray;

      public interface Hello extends Remote
      {
      public String hello(String name) throws RemoteException;
      public StringArray getUics() throws RemoteException;
      public String getText() throws RemoteException;
      }


      config.xml

      <?xml version="1.0" encoding="UTF-8"?>







      ws4ee-deployment.xml I have tried this on and left it out with no difference.


      <?xml version="1.0" encoding="UTF-8"?>
      <deployment
      xmlns='http://xml.apache.org/axis/wsdd/'
      xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
      xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
      xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
      xmlns:xsd='http://www.w3.org/2001/XMLSchema'>


      <!-- <typeMapping
      encodingStyle=""
      qname="ns2:StringArray"
      serializer="org.jboss.axis.encoding.ser.BeanSerializerFactory"
      deserializer="org.jboss.axis.encoding.ser.BeanDeserializerFactory"
      type="java:mil.tis.demo.types.StringArray"
      xmlns:ns2="http://mil.tis.demo.types/"/> -->

      <!-- <typeMapping
      qname='ns1:CustomerOrderPosition' xmlns:ns1='http://org.jboss.webservice/complexbean'
      type='java:org.jboss.webservice.complexbean.CustomerOrderPosition'
      serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
      deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
      encodingStyle=''
      /> -->

      <!-- <typeMapping
      deserializer="org.apache.axis.encoding.ser.ElementDeserializerFactory"
      encodingStyle=""
      qname="ns2:StringArray"
      serializer="org.apache.axis.encoding.ser.ElementSerializerFactory"
      type="java:javax.xml.soap.SOAPElement"
      xmlns:schema="http://mil.tis.demo/types"/> -->




      webservices.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <webservices
      xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
      http://java.sun.com/xml/ns/j2ee/j2ee_web_services_1_1.xsd" version="1.1">

      <webservice-description>
      <webservice-description-name>HelloService</webservice-description-name>
      <wsdl-file>WEB-INF/wsdl/HelloService.wsdl</wsdl-file>
      <jaxrpc-mapping-file>WEB-INF/mappings/mapping.xml</jaxrpc-mapping-file>
      <port-component>
      <port-component-name>Hello</port-component-name>
      <wsdl-port>HelloPort</wsdl-port>
      <service-endpoint-interface>mil.tis.demo.Hello</service-endpoint-interface>
      <service-impl-bean>
      <servlet-link>HelloServlet</servlet-link>
      </service-impl-bean>
      </port-component>
      </webservice-description>


        • 1. Re: JAX-RPC HELP!!
          rkite01

          Here is the StringArray.java wrapper class.

          package mil.tis.demo.types;
          import java.io.Serializable;
          public class StringArray implements Serializable
          {
          private String[] insStringArray = null;
          public StringArray() { }
          public String[] getValue() {return(insStringArray);}
          public void setValue(String[] value) {insStringArray = value;}
          }

          • 2. Re: JAX-RPC HELP!!
            rkite01

            Client Test program.


            package mil.tis.demo;

            import javax.xml.rpc.Service;
            import javax.xml.rpc.ServiceFactory;
            import java.net.URL;
            import mil.tis.demo.Hello;
            import javax.xml.namespace.QName;

            public class HelloTest
            {
            public static void main(String[] args)
            {
            try {
            hello(args);
            }
            catch (Exception e) {
            e.printStackTrace();
            }
            }

            public static String hello(String[] args) throws Exception {
            String urlStr = "http://localhost:3809/tisWebServices/Hello?wsdl";
            String argument = "Dooda";
            System.out.println("Contracting webservice at " + urlStr);
            URL url = new URL(urlStr);
            QName qName = new QName("http://mil.tis.demo/", "HelloService");
            ServiceFactory factory = ServiceFactory.newInstance();
            Service service = factory.createService(url, qName);

            Hello hello = (Hello)service.getPort(Hello.class);
            String result = hello.hello(argument);
            String result2 = hello.getText();
            System.out.println(result);
            // This is the line that fails.
            Object uicStringArray = hello.getUics();
            return(result);
            }


            }

            • 3. Re: JAX-RPC HELP!!
              rkite01

              I figured it out.
              The web server servlet class and remote interface still use String[] as a function return type. The StringArray.java class is generated from the wscompile step and is not referenced from the java code. I had to hand modify the mapping file and add an entry for the StringArray class. It would be nice if this entry was generated from wscompile (Maybe there is an option?). The new xml is added to the mapping .xml file after the package mappings. Now to learn complex object passing.

              <!-- Hand inserted Code -->
              <java-xml-type-mapping>
              <java-type>java.lang.String[]</java-type>
              <root-type-qname xmlns:typeNS="http://mil.tis.demo.types/arrays/java/lang">typeNS:StringArray</root-type-qname>
              <qname-scope>complexType</qname-scope>
              </java-xml-type-mapping>

              • 4. Re: JAX-RPC HELP!!
                jason.greene

                Instead of using the wscompile generated stubs use a J2EE web service client, which uses the jboss web services stack.

                ]http://wiki.jboss.org/wiki/Wiki.jsp?page=WSRPCClientStepByStep
                -Jason

                • 5. Re: JAX-RPC HELP!!
                  sudhakaratbits

                  Jason,
                  This URL doesnt work. Moved somewhere?

                  • 6. Re: JAX-RPC HELP!!
                    thomas.diesler