Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Axis deserializer cannot be found

  1. #1
    Join Date
    Apr 2005
    Posts
    22

    Default Axis deserializer cannot be found

    Greetings.

    I've just spent several hours trying to solve the problem with not being able to deserialize an XML response on the client side.

    I successfully deployed an Axis service, and am able to invoke findSchoolByName method, which returns a valid XML message (I intercepted and verified it using TCPMonitor). However, the client throws the following error:
    org.xml.sax.SAXException: Deserializing parameter 'findSchoolByNameReturn': could not find deserializer for type {urn:dss.sww.com}School

    I followed the JPetStore example from Spring 1.2RC1. My client bean is declared as follows:
    <bean id="jaxRpcProxy" class="org.springframework.remoting.jaxrpc.JaxRpcP ortProxyFactoryBean">
    I also registered BeanMappingServicePostProcessor class, which implements JaxRpcServicePostProcessor, as the "servicePostProcessors" property of the client bean the same way it was done in JPetStore. The BeanMappingServicePostProcessor does kick in and register the type mappings, which can be seen from the stack trace at the end of this message.

    Please help me!

    Here is the XML response from the Axis service:

    <?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>
    <findSchoolByNameResponse xmlns="urn:dss.sww.com">
    <findSchoolByNameReturn>
    <name>Shkola</name>
    </findSchoolByNameReturn>
    </findSchoolByNameResponse>
    </soapenv:Body>
    </soapenv:Envelope>

    Below is the pertinent stack trace:

    Registered bean mapping for XMLType {urn:dss.sww.com}AModel with class com.sww.dss.domain.model.hibernate.AModel
    Registered bean mapping for XMLType {urn:dss.sww.com}School with class com.sww.dss.domain.model.hibernate.School
    2005-04-14 20:44:34,078: org.springframework.remoting.jaxrpc.JaxRpcPortProx yFactoryBean,INFO,: Using JAX-RPC dynamic calls for JAX-RPC port [{urn:dss.sww.com}SchoolService]
    2005-04-14 20:44:34,250: org.springframework.aop.framework.DefaultAopProxyF actory,INFO,: CGLIB2 available: proxyTargetClass feature enabled
    Calling SchoolService 'jaxRpcProxy' with school name Shkola
    Using SchoolService: JAX-RPC proxy for port [SchoolService] of service [{urn:dss.sww.com}JaxRpcSchoolServiceService]
    2005-04-14 20:44:34,734: org.apache.axis.client.Call,ERROR,: Exception:
    org.xml.sax.SAXException: Deserializing parameter 'findSchoolByNameReturn': could not find deserializer for type {urn:dss.sww.com}School
    at org.apache.axis.message.RPCHandler.onStartChild(RP CHandler.java:273)
    at org.apache.axis.encoding.DeserializationContext.st artElement(DeserializationContext.java:1031)
    at org.apache.axis.message.SAX2EventRecorder.replay(S AX2EventRecorder.java:165)
    at org.apache.axis.message.MessageElement.publishToHa ndler(MessageElement.java:1140)
    at org.apache.axis.message.RPCElement.deserialize(RPC Element.java:238)
    at org.apache.axis.message.RPCElement.getParams(RPCEl ement.java:386)
    at org.apache.axis.client.Call.invoke(Call.java:2402)
    at org.apache.axis.client.Call.invoke(Call.java:2301)
    at org.apache.axis.client.Call.invoke(Call.java:1758)
    at org.springframework.remoting.jaxrpc.JaxRpcPortClie ntInterceptor.performJaxRpcCall(JaxRpcPortClientIn terceptor.java:492)
    at org.springframework.remoting.jaxrpc.JaxRpcPortClie ntInterceptor.invoke(JaxRpcPortClientInterceptor.j ava:451)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
    at $Proxy0.findSchoolByName(Unknown Source)
    at com.sww.dss.service.client.SchoolServiceClient.inv okeSchoolServices(SchoolServiceClient.java:46)
    at com.sww.dss.service.client.SchoolServiceClient.mai n(SchoolServiceClient.java:74)

  2. #2
    Join Date
    Apr 2005
    Posts
    22

    Default

    After several hours of trying I still can't get my Axis client to work with my web service unsing WRAPPED style. Once I switched to rpc/encoded it started working.

    Has anyone gotten an Axis client to work with a web service, which uses WRAPPED style?

    Do I need to register my type mappings differently if I use wrapped style?

    Thanks.

  3. #3
    Join Date
    Aug 2004
    Location
    Tampa, FL
    Posts
    39

    Default

    I'm also having the same problem with JaxRpcPortProxyFactoryBean for web services that work with rpc/encoded, but don't for wrapped/literal. From looking at what Axis's WSDL2Java tool generates, the type mapping code for wrapped/literal is different than that of rpc/encoded. I'd also like to know what a JaxRpcServicePostProcessor would look like for a wrapped/literal Axis web service.
    Nilesh Kapadia
    http://www.nileshk.com

  4. #4
    Join Date
    Mar 2005
    Location
    Rochester, NY
    Posts
    27

    Default Same here...

    I'm having the same problem... I've been bugging the Apache Axis people with it, but I'm thinking it might be a Spring problem.

    Mine was actually working with Spring 1.2-rc1 and Axis 1.1 on JDK1.4, but when I wanted to move up to JDK5 I had to also upgrade to Axis 1.2RC3. I've found and fixed a couple of bugs in their Call class, but now it comes down to type mappings.

    With "literal" the encodingStyle is nulled out by Axis, so it can't be used to loo up the type mappings registered by my proxy factory bean. The Axis binding stub does this for type conversion:

    Code:
    org.apache.axis.description.OperationDesc oper;
            oper = new org.apache.axis.description.OperationDesc&#40;&#41;;
            oper.setName&#40;"GetWeatherInfo"&#41;;
            oper.addParameter&#40;new javax.xml.namespace.QName&#40;"http&#58;//ejse.com/WeatherService/", "zipCode"&#41;, new javax.xml.namespace.QName&#40;"http&#58;//www.w3.org/2001/XMLSchema", "int"&#41;, int.class, org.apache.axis.description.ParameterDesc.IN, false, false&#41;;
            oper.setReturnType&#40;new javax.xml.namespace.QName&#40;"http&#58;//ejse.com/WeatherService/", "WeatherInfo"&#41;&#41;;
            oper.setReturnClass&#40;com.eplus.app.service.bind.weather.WeatherInfo.class&#41;;
            oper.setReturnQName&#40;new javax.xml.namespace.QName&#40;"http&#58;//ejse.com/WeatherService/", "GetWeatherInfoResult"&#41;&#41;;
            oper.setStyle&#40;org.apache.axis.constants.Style.WRAPPED&#41;;
            oper.setUse&#40;org.apache.axis.constants.Use.LITERAL&#41;;
            _operations&#91;0&#93; = oper;
    and later puts this OpertationDesc object into a new Call instance so the call knows explicitly the type conversion. This is different from the way Spring's example shows:

    Code:
    public class WeatherServiceJaxRpcProxyFactoryBean extends JaxRpcPortProxyFactoryBean &#123;
        protected void postProcessJaxRpcService&#40;Service service&#41; &#123;
            TypeMappingRegistry tmr = service.getTypeMappingRegistry&#40;&#41;;
            TypeMapping tm = tmr.createTypeMapping&#40;&#41;;
    
            registerMapping&#40;tm, "WeatherInfo", WeatherInfo.class&#41;;
            registerMapping&#40;tm, "ExtendedWeatherInfo", ExtendedWeatherInfo.class&#41;;
            registerMapping&#40;tm, "DayForecastInfo", DayForecastInfo.class&#41;;
            registerMapping&#40;tm, "NineDayForecastInfo", NineDayForecastInfo.class&#41;;
            registerMapping&#40;tm, "ForecastDays", ForecastDays.class&#41;;
            registerMapping&#40;tm, "IraqCities", IraqCities.class&#41;;
            tmr.register&#40;org.apache.axis.Constants.URI_SOAP11_ENC, tm&#41;;
        &#125;
    
        private void registerMapping&#40;TypeMapping tm, String name, Class clazz&#41; &#123;
            QName qname = new QName&#40;"http&#58;//ejse.com/WeatherService/",name&#41;;
    
            tm.register&#40;clazz,qname,
                    new BeanSerializerFactory&#40;clazz, qname&#41;,
                    new BeanDeserializerFactory&#40;clazz, qname&#41;&#41;;
        &#125;
    &#125;

    I'd really like to get this working, if anyone has any ideas...

  5. #5
    Join Date
    Mar 2005
    Location
    Rochester, NY
    Posts
    27

    Default Re: Same here...

    Helloooo????!

    Can a maintainer of the Spring Remoting code maybe try out an example of using the Spring JaxRpcProxyFactoryBean using Axis 1.2RC3 and a "literal" web service type? Using JDK5 would be nice, but not required...

  6. #6
    Join Date
    Mar 2005
    Location
    Rochester, NY
    Posts
    27

    Default Well, since no-one from Spring can bother...

    I got this working... Instead of this:

    tmr.register(org.apache.axis.Constants.URI_SOAP11_ ENC, tm);

    I used this for my literal-encoded web service:

    tmr.register("", tm);

    and it works.

  7. #7
    Join Date
    Aug 2004
    Location
    Tampa, FL
    Posts
    39

    Default

    I have a few web service methods that work (of "literal" type). But I have one that has an array of beans as return type. When I call this method it executes successfully on the server side, then when the client is handling the response it throws this exception:

    Code:
    java.lang.ClassCastException&#58; java.util.ArrayList
    	at $Proxy0.loadBookmarkList&#40;Unknown Source&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
    	at java.lang.reflect.Method.invoke&#40;Method.java&#58;585&#41;
    	at org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke&#40;RmiClientInterceptorUtils.java&#58;98&#41;
    	at org.springframework.remoting.rmi.RmiClientInterceptorUtils.invoke&#40;RmiClientInterceptorUtils.java&#58;71&#41;
    	at org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.invoke&#40;JaxRpcPortClientInterceptor.java&#58;442&#41;
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed&#40;ReflectiveMethodInvocation.java&#58;144&#41;
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke&#40;JdkDynamicAopProxy.java&#58;174&#41;
    	at $Proxy1.loadBookmarkList&#40;Unknown Source&#41;
    	at com.myconnector.client.BkMethods.start&#40;BkMethods.java&#58;51&#41;
    Here's a snippet from typemapping code:
    Code:
    	public void postProcessJaxRpcService&#40;Service service&#41; &#123;
    		TypeMappingRegistry registry = service.getTypeMappingRegistry&#40;&#41;;
    		TypeMapping mapping = registry.createTypeMapping&#40;&#41;;
            registerBeanMapping&#40;mapping, BookmarkDTO.class, "BookmarkDTO"&#41;;
            registry.register&#40;"", mapping&#41;;
    	&#125;
    
    	protected void registerBeanMapping&#40;TypeMapping mapping, Class type, String name&#41; &#123;
    		QName xmlType = new QName&#40;this.typeNamespaceUri, name&#41;;
    		mapping.register&#40;type, xmlType,
    		    new BeanSerializerFactory&#40;type, xmlType&#41;,
    		    new BeanDeserializerFactory&#40;type, xmlType&#41;&#41;;		
    	&#125;
    The method I am calling is returning BookmarkDTO[]

    Has anyone got passing/returning array of beans (or a bean that has an array of beans in it) to work for doc/literal?

    For now, I am just using Axis generated proxy classes (which works). But using Spring's support so that I can just use my interface and beans already defined (without having to generate code) is a nice ideal.
    Nilesh Kapadia
    http://www.nileshk.com

  8. #8
    Join Date
    May 2005
    Location
    Pune, India
    Posts
    4

    Default ClassCastException with JaxRpcProxyFactoryBean

    Hi,

    I am having similar problem, any solution will be very useful.

    Regards
    Manish

    Quote Originally Posted by nilesh
    I have a few web service methods that work (of "literal" type). But I have one that has an array of beans as return type. When I call this method it executes successfully on the server side, then when the client is handling the response it throws this exception:

    Code:
    java.lang.ClassCastException&#58; java.util.ArrayList
    	at $Proxy0.loadBookmarkList&#40;Unknown Source&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke0&#40;Native Method&#41;
    	at sun.reflect.NativeMethodAccessorImpl.invoke&#40;NativeMethodAccessorImpl.java&#58;39&#41;
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke&#40;DelegatingMethodAccessorImpl.java&#58;25&#41;
    	at java.lang.reflect.Method.invoke&#40;Method.java&#58;585&#41;
    	at org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke&#40;RmiClientInterceptorUtils.java&#58;98&#41;
    	at org.springframework.remoting.rmi.RmiClientInterceptorUtils.invoke&#40;RmiClientInterceptorUtils.java&#58;71&#41;
    	at org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.invoke&#40;JaxRpcPortClientInterceptor.java&#58;442&#41;
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed&#40;ReflectiveMethodInvocation.java&#58;144&#41;
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke&#40;JdkDynamicAopProxy.java&#58;174&#41;
    	at $Proxy1.loadBookmarkList&#40;Unknown Source&#41;
    	at com.myconnector.client.BkMethods.start&#40;BkMethods.java&#58;51&#41;
    Here's a snippet from typemapping code:
    Code:
    	public void postProcessJaxRpcService&#40;Service service&#41; &#123;
    		TypeMappingRegistry registry = service.getTypeMappingRegistry&#40;&#41;;
    		TypeMapping mapping = registry.createTypeMapping&#40;&#41;;
            registerBeanMapping&#40;mapping, BookmarkDTO.class, "BookmarkDTO"&#41;;
            registry.register&#40;"", mapping&#41;;
    	&#125;
    
    	protected void registerBeanMapping&#40;TypeMapping mapping, Class type, String name&#41; &#123;
    		QName xmlType = new QName&#40;this.typeNamespaceUri, name&#41;;
    		mapping.register&#40;type, xmlType,
    		    new BeanSerializerFactory&#40;type, xmlType&#41;,
    		    new BeanDeserializerFactory&#40;type, xmlType&#41;&#41;;		
    	&#125;
    The method I am calling is returning BookmarkDTO[]

    Has anyone got passing/returning array of beans (or a bean that has an array of beans in it) to work for doc/literal?

    For now, I am just using Axis generated proxy classes (which works). But using Spring's support so that I can just use my interface and beans already defined (without having to generate code) is a nice ideal.

  9. #9
    Join Date
    Oct 2005
    Location
    Amsterdam
    Posts
    81

    Default

    Hello, everybody (please have a look at my stacktrace)
    I have similar problems, the first thing I want to look at is how to change rpc/encoded, to wrapped/literal (or the opposite)?
    Any help would be awesome!!
    Cheers

    Nicolas

    Code:
    org.xml.sax.SAXException: Deserializing parameter 'createUserReturn':  could not find deserializer for type {http://beans.soap.rpc.jira.atlassian.com}RemoteUser at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
            at org.apache.axis.encoding.DeserializationContext.startElement(Deserial
    izationContext.java:1035)
            at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.ja
    va:165)
            at org.apache.axis.message.MessageElement.publishToHandler(MessageElemen
    t.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)
    I have a class that extends JaxRpcPortProxyFactoryBean that contains those methods.

    Code:
      public void postProcessJaxRpcService(Service service) {
            log.debug("TRACING postProcessJaxRpcService ----------------");
            TypeMappingRegistry registry = service.getTypeMappingRegistry();
            TypeMapping mapping = registry.createTypeMapping();
            registerBeanMapping(mapping, RemoteUser.class, "RemoteUser");
            registry.register(this.encodingStyleUri, mapping);
        }
    Code:
        protected void registerBeanMapping(TypeMapping mapping, Class type, String name) {
            QName xmlType = new QName(this.typeNamespaceUri, name);
            mapping.register(type, xmlType,
                new BeanSerializerFactory(type, xmlType),
                new BeanDeserializerFactory(type, xmlType));
        }

  10. #10
    Join Date
    Oct 2005
    Location
    Amsterdam
    Posts
    81

    Default

    Ok, I think I fixed the issue. It was a namespace issue (and had nothing to do with Spring in the first place.

    In my postProcessJaxRpcService method the "this.typeNamespaceUri" variable pointed to "http://localhost:8081/rcp/soap..." instead of "http://beans.soap.rpc.jira.atlassian.com" as required... ({http://beans.soap.rpc.jira.atlassian.com}RemoteUser)

    Thanks

    Nicolas

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. Unit testing with JOTM and JtaTransactionManager
    By lalle in forum Architecture
    Replies: 1
    Last Post: Oct 15th, 2005, 09:05 AM
  3. EHCaching Hibernate
    By dencamel in forum Data
    Replies: 3
    Last Post: Sep 6th, 2005, 09:03 PM
  4. Replies: 4
    Last Post: Aug 17th, 2005, 04:42 AM
  5. Replies: 1
    Last Post: Apr 13th, 2005, 10:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •