miller2j
miller2j

Reputation: 89

org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType using Axis in Java

I am making a soap call using Java source packages that was created from a WSDL.

After inserting the neccessary details the application makes the call and receives the errors;

Code:

public static String getRioInformation(String msisdn, String endpoint_address) {
     String rio_response="";
   try {
       System.out.println("here  :");
       FwiEsbWs4USSDLocator locator=new FwiEsbWs4USSDLocator();
       locator.setMaintainSession(true);

       locator.setFwiEsbWs4USSDEndPointEndpointAddress(endpoint_address);

       FwiEsbWs4USSDSoapBindingStub temp;

       FwiEsbWs4USSD fwi;
       FwiEsbWs4USSDPortType port;
       GetRioInformationsRequest rio=new GetRioInformationsRequest();
       RioSearchRequest search=new RioSearchRequest();
       search.setMsisdn(msisdn);

       DefaultContext def_context = new DefaultContext();
       DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
       def_context.setEffectiveDatetime(Calendar.getInstance());

       def_context.setSystem(MappingSystem.USSD);
       search.setContext(def_context);
       rio.setRioSearchRequest(search);

       FwiEsbWs4USSD cg= null;

       //QName q = new QName("http://service.digicel.fr/", "GetRioInformationsRequest");
       int responseCode=0;
       try {
            //cg=locator.;

           port =  locator.getFwiEsbWs4USSDEndPoint();


           DefaultResponse def=new DefaultResponse();



           def= port.getRioInformations(rio);

           ContextEnrichment context = def.getEnrichment();
           RioInformation[] rio_info =context.getRioInformation();
           rio_response = rio_info[0].getRIO();
       } catch (ServiceException ex) {
           System.out.println("ex 1 :"+ex);
       } 


  } catch (Exception e) {
    System.err.println("SOAP Call Error: "+e.toString());
    e.printStackTrace();
  }
   return rio_response;
}

Error:

SOAP Call Error: org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode: 
faultString: org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
faultActor: 
faultNode: 
faultDetail: 
    {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
    at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:314)
    at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
    at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
    at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.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:2448)
    at org.apache.axis.client.Call.invoke(Call.java:2347)
    at org.apache.axis.client.Call.invoke(Call.java:1804)
    at fr.digicel.service.DigicelFwiEsbWs4USSDSoapBindingStub.getRioInformations(DigicelFwiEsbWs4USSDSoapBindingStub.java:2333)
    at com.digicel.mynumber.SOAPInteractions.getRioInformation(SOAPInteractions.java:107)
    at com.digicel.mynumber.Main.<init>(Main.java:97)
    at com.digicel.mynumber.Main.main(Main.java:253)
org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
    at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
    at org.apache.axis.client.Call.invoke(Call.java:2451)
    at org.apache.axis.client.Call.invoke(Call.java:2347)
    at org.apache.axis.client.Call.invoke(Call.java:1804)
    at fr.digicel.service.DigicelFwiEsbWs4USSDSoapBindingStub.getRioInformations(DigicelFwiEsbWs4USSDSoapBindingStub.java:2333)
    at com.digicel.mynumber.SOAPInteractions.getRioInformation(SOAPInteractions.java:107)
    at com.digicel.mynumber.Main.<init>(Main.java:97)
    at com.digicel.mynumber.Main.main(Main.java:253)
Caused by: org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
        at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:314)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.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:2448)
        ... 6 more

The error is happening on the line "def= port.getRioInformations(rio);", what would be needed to resolve the error? What would be the sample Deserializer code need to resolve this issue?

Upvotes: 3

Views: 9641

Answers (1)

Syed Umar
Syed Umar

Reputation: 91

I have fought with the same problem after puting effort of days and help of coworkers, i've reached to conclusion.In your responceType class(which you want to parse from xml responce ot object) in static block. elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "anyType"));

Change this QName to

elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));

Upvotes: 3

Related Questions