Error deserializing user defined Type via JAX-RPC


XML & Web services: Error deserializing user defined Type via JAX-RPC

  1. Hi All,

    My problem seems trivial but here goes:

    Implementation: JAX-RPC 1.0
    Implementor: Weblogic 7.0

    I have defined a simple stateless EJB web service called
    Quote that simply returns a user defined type called

    my Bean´s Remote:

    public interface Quote extends EJBObject
      public QuoteResult getQuote() throws java.rmi.RemoteException;

      public void setQuote(String strQuote, String strValor) throws java.rmi.RemoteException;

    My problem is when I try and invoke the webservice passing in the wsdl to create the Service it complains that it can´t find the mapping
    of my defined type which is defined in the web-services.xml

          <type-mapping-entry deserializer="com.indra.webservice.QuoteResultCodec" class-name="com.indra.webservice.QuoteResult" xmlns:p1="java:com.indra.webservice" type="p1:QuoteResult" serializer="com.indra.webservice.QuoteResultCodec">

    My Code:

           // Setup the global JAXM message factory
          // Setup the global JAX-RPC service factory
          System.setProperty( "javax.xml.rpc.ServiceFactory","weblogic.webservice.core.rpc.ServiceFactoryImpl");

        // create service factory
        ServiceFactory factory = ServiceFactory.newInstance();
        // define qnames
        String targetNamespace = "";
        QName serviceName = new QName(targetNamespace,"QuoteService");
        QName portName = new QName(targetNamespace,"QuoteServicePort");
        QName operationName = new QName("urn:QuoteService", "getQuote");
        URL wsdlLocation = new URL("http://gmacariw2k:7001/webservice/QuoteService?WSDL");
        // create service
        Service service = factory.createService(wsdlLocation, serviceName);

        TypeMappingRegistry objTypeMappingRegistry=service.getTypeMappingRegistry();
        TypeMapping mapNew = objTypeMappingRegistry.getTypeMapping("");
        //deserializer="com.indra.webservice.QuoteResultCodec" class-name="com.indra.webservice.QuoteResult" xmlns:p1="java:com.indra.webservice" type="p1:QuoteResult" serializer="com.indra.webservice.QuoteResultCodec"
        com.indra.webservice.QuoteResultCodec objQuoteResultCodec = new QuoteResultCodec();
        mapNew.register(Class.forName("com.indra.webservice.QuoteResult"),new QName("java:com.indra.webservice","QuoteResult"),objQuoteResultCodec,objQuoteResultCodec);
        // create call
        Call call = service.createCall(portName, operationName);

        // invoke the remote web service
        Object obj = call.invoke(null);
    catch(Exception ex)

    As you can see I have commented out the TypeMapping stuff as
    it makes no difference.

    This is the error:

    WARNINIG: Unable to find a javaType for the xmlType:['java:com.indra.webservice']:QuoteResult. Make sure that you have registered this xml type in the type mapping
    Using SOAPElement instead
    javax.xml.rpc.JAXRPCException: failed to invoke operation. Error in the soap layer (jaxm); nested exception is: Message[failed to deserialize xml:weblogic.xml.schema.binding.DeserializationException: mapping lookup failure for xml type ['java:com.indra.webservice']:QuoteResult and java interface javax.xml.soap.SOAPElement]StackTrace[

    When I use the stubs directly, it works fine:

            QuoteService_Impl impl = new QuoteService_Impl("http://gmacariw2k:7001/webservice/QuoteService?WSDL");
            QuoteServicePort port = impl.getQuoteServicePort();

            QuoteResult objQuoteResult = port.obtenerQuote();

    I think what I am missing is the ability to "register" my
    Object QuoteResult as its serializers/deserializers with the
    TypeMappingRegistry but I can´t seem to find an example.

    Thanks for reading!!!,

  2. Hi,
    I have run into same issue when I try to invoke a web service with JAX-RPC. Did you manage to find the solution? Please post the solution, if you know.

    Thanks & Regards,