Could not find deserializer for type: Error

I need to make a SOAP call from my java program for which I used apache axis. My program looks like this:

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.rpc.ParameterMode;
import javax.xml.namespace.QName;
public class Project {
   public static void main(String [] args) {

   try {

       String endpoint ="http://RequestUrl";
       Service  service = new Service();
       Call call = (Call) service.createCall();
       call.setTargetEndpointAddress( new );
       call.setOperationName(new QName(endpoint, "getFrsFileData"));
       String value = (String) call.invoke(new Object[] { "24BB7","frs1001" } );

    catch (Exception e) {



This when executed gives an error like this

  • Exception: org.xml.sax.SAXException: deserialization parameter "getFrsFileDataReturn": Could not find deserializer for type {http: // Url} FrsFileSoapDO at org.apache.axis.message.RPCHandler.onStartChild ( at org.apache.axis.encoding.DeserializationContext.startElement ( at org.apache.axis.message.SAX2EventRecorder.replay ( at org.apache.axis.message.Message at org.apache.axis.message.RPCElement.deserialize ( at org.apache.axis.message.RPCElement.getParams ( at org.apache.axis .client.Call.invoke ( at org.apache.axis.client.Call.invoke ( at org.apache.axis.client.Call.invoke ( ) in Project.main ( org.xml.sax.SAXException:deserialization parameter "getFrsFileDataReturn": Could not find deserializer for type {http: // Url} FrsFileSoapDO

Tried the same call using SOAPUI but it didn't help me debug this.

Please help me in debugging this java code,



source to share

2 answers

I got help from a friend of mine and was able to arrive at an answer. The problem is that the soap call gives a soap response that comes as a bean of type "FrsFileSoapDO". Since I didn't give anything in the code on how my program would understand the received bean, it gave me an error saying "could not find deserializer for type {http://Url}FrsFileSoapDO

". Now a step to fix the problem:

1) create a "QName" to say what the namespace to which "FrsFileSoapDO" belongs.

2) create a serializer bean (which knows how to serialize a bean),

3) create a bean deserializer (which knows how to deserialize a bean),

4) Map the mapping indicating that the QName q is mapping the FrsFileSoapDO.class class (before that, make sure you have FrsFileSoapDO.class with you and you imported it)

Now let's implement this in a program (I am only repeating the try block here)

try {

   String endpoint ="http://RequestUrl";
   Service  service = new Service();
   Call call = (Call) service.createCall();
   call.setTargetEndpointAddress( new );

   QName q = new QName ("http://Url", "FrsFileSoapDO"); // step 1
   BeanSerializerFactory bsf =   new BeanSerializerFactory(FrsFileSoapDO.class,q);   // step 2
   BeanDeserializerFactory bdf = new BeanDeserializerFactory(FrsFileSoapDO.class,q);  // step 3
   call.registerTypeMapping(FrsFileSoapDO.class,q, bsf, bdf); //step 4

   call.setOperationName(new QName(endpoint, "getFrsFileData"));
   FrsFileSoapDO s = (FrsFileSoapDO) call.invoke(new Object[] { "24BB7","frs1001" } );  


This gives me the expected result.

The document for Call, BeanSerializerFactory, BeanDeserializerFactory functions is available at BeanSerializerFactory and BeanDeserializerFactory



I had the same problem. The only error I think is in your code below:

call.setOperationName(new QName(endpoint, "getFrsFileData"));


You should not use an endpoint for the QName constructor parameter. Alternatively, you can leave it blank if you are only sending string parameters, but in case of some complex data, you must provide a mapping here from the wsdl file. Check the parameters in the wsdl file for this web service method and give the same mapping here. For example, for me it was a file transfer, so the entry in wsdl was:

<wsdl:message name="sendFileRequest">
  <wsdl:part name="in0" type="apachesoap:DataHandler"/>
  <wsdl:part name="in1" type="soapenc:string"/>


and in the client code, you specify the same type as:

call.setOperationName( new QName("apachesoap:MatrixService", "sendFile") );
QName fileAttachment = new QName("apachesoap:MatrixService", "DataHandler");


After that, you need to define a map for it using registerTypeMapping.



All Articles