3

我正在使用从 WSDL 创建的 Java 源包进行肥皂调用。

插入必要的详细信息后,应用程序进行调用并接收错误;

代码:

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);”行上,解决该错误需要什么?解决此问题需要什么示例反序列化程序代码?

4

1 回答 1

3

经过几天的努力和同事的帮助后,我已经解决了同样的问题,我得出了结论。在静态块中的你的 responceType 类(你想从 xml 响应 ot 对象中解析)中。 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"));

于 2015-09-30T08:24:21.597 回答