PDA

View Full Version : JAXRPC web service - Deserializing problems



seanoshea
Feb 14th, 2005, 05:21 AM
Hi there,

I'm trying to connect to a web service using JAXRPC and Spring and I'm using the JPetstore example as my reference application.

I'm getting a strange error saying:
The following exception was logged org.xml.sax.SAXException: Deserializing parameter '***name of my return type here***': could not find deserializer for type {***namespace***}***name of my return type here***

My return type from the web service call is a simple value object with a String member variable. I was under the impression that I should not have to specify a custom deserializer for such a simple value object.

I have connected directly to the web service using stubs I generated using wsdl2java, so I know there's nothing wrong with the web service.

Might someone be able to offer me advice on this?

dan.baumann
Feb 15th, 2005, 11:53 AM
I think you need to register any custom type, even if it's really simple.

I'm currently trying to access a SOAP service as is shown in chapter 16 of Pro Spring, and I'm also running into "could not find deserializer for type" error messages - even though I did do everything by the book.

seanoshea
Feb 15th, 2005, 12:32 PM
Hi there,

I was able to fix the problem I was having earlier on in the post.
This is what I did.
This is my clientContext.xml file ... much like the clientContext.xml file in the JPetStore example.


<bean id="jaxRpcProxy" class="*** create a class which extends org.springframework.remoting.jaxrpc.JaxRpcPortProx yFactoryBean***">
<property name="serviceInterface">
<value>***put the class name corresponding to your service interface in here***</value>
</property>
<property name="portInterface">
<value>***put the class name corresponding to your port interface in here &#40;this should throw a remote exception&#41;***</value>
</property>
<property name="serviceFactoryClass">
<value>org.apache.axis.client.ServiceFactory</value>
</property>
<property name="wsdlDocumentUrl">
<value>*** put the location of your wsdl file in here***</value>
</property>
<property name="namespaceUri">
<value>*** namespace for the wsdl goes in here***</value>
</property>
<property name="serviceName">
<value>*** name of the service you are trying to connect to goes in here***</value>
</property>
<property name="portName">
<value>*** The port name in your wsdl file goes in here***</value>
</property>
<property name="endpointAddress">
<value>*** The endpoint address goes in here***</value>
</property>
</bean>


I had left out the endpointAddress property and I think this is what led to my original error.

The class that you create which extends org.springframework.remoting.jaxrpc.JaxRpcPortProx yFactoryBean should look like AxisPortProxyFactoryBean in the JPetStore example. Its probably a good idea to register all classes which you are serializing and deserializing in this code.

Hope this clears up issues for anyone who was having the same problem as I was.