有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

组织。xml。萨克斯。SAXException:没有针对的反序列化程序{http://www.w3.org/2001/XMLSchema}Java中使用Axis的anyType

我正在使用从WSDL创建的Java源程序包进行soap调用

在插入必要的细节后,应用程序进行调用并接收错误

代码:

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;
}

错误:

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

错误发生在“def=port.getRioInformations(rio);”行上,解决错误需要什么? 要解决此问题,示例反序列化程序代码需要什么


共 (1) 个答案

  1. # 1 楼答案

    经过几天的努力和同事们的帮助,我终于得出了结论。在静态块中的responceType类中(要从xml ResponceOT对象解析该类)。 elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "anyType"));

    将此QName更改为

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