Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Axis fault: java.io.IOException: No serializer found for class

 
jeetu krishnan
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how to pass java objects as a parameter in a web service call ? can you provide a sample client code.

I am getitng the following error when trying to invoke the webservice using a client generated by axis:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.io.IOException: No serializer found for class ObjectDSConstructor.objectDS.MyObject in registry org.apache.axis.encoding.TypeMappingDelegate@1c7865b
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.io.IOException: No serializer found for class ObjectDSConstructor.objectDS.MyObject in registry org.apache.axis.encoding.TypeMappingDelegate@1c7865b
 
Faraz Masood
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your class must implement the java.io.Serializable interface, so that it can be serialised/de-serialised and sent back n forth
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it's not about the Serializable interface. In the context of web services, serialization means the objects to be transported over SOAP need to be convertable to XML and back.

If you're trying to send an object Axis doesn't know, you need to configure a serializer to be used. If the object has bean characteristics, you can use the BeanSerializer that comes with Axis. If it doesn't, you need to implement custom serialization classes.

In general it's preferable to use standard data types only (in other words, not to use custom classes). That gives you a better chance to create a WS that works cross-platform.
 
Faraz Masood
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ahh i see ... thanks Ulf
 
Suzanne Byington
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree that whenever possible, use the axis standard supported object types for objects returned from public methods in the web service. For those who are interested. I have experience returning custom objects to a C++ client.

Netbeans automatically added the definitions for the custom types into the wsdl file; however, I had to manually add the line to export/register the custom type as available by adding the following to my myWS.deploy.wsdd file:
<beanMapping qname="myNS:InformationCorrection" xmlns:myNS="urn:myWS" languageSpecificType="java:myservice.model.InformationCorrection"/>

InformationCorrection is my custom object and is located in myservice/model/InformationCorrection.java in my web service project.

Here is the entire contents of my myWS.deploy.wsdd file:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="myWS" provider="java:RPC">
<parameter name="className" value="myservice.myWS"/>
<parameter name="allowedMethods" value="*"/>
<beanMapping qname="myNS:InformationCorrection" xmlns:myNS="urn:myWS" languageSpecificType="java:myservice.model.InformationCorrection"/>
</service>
</deployment>
 
Suzanne Byington
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I failed to mention that adding the bean mapping to the deploy.wsdd file as I described above will fix the issue originally reported in this topic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic