日期:2014-05-19  浏览次数:20822 次

求助:No deserializer for {http://www.w3.org/2001/XMLSchema}anyType 是什么错误啊?
这是源代码:
try {
Service service=new Service();
Call call=(Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL("https://xx.xxx.xxx.xx/cardsws/cardsws.asmx"));
call.setOperationName(new QName("https://xx.xxx.xxx.xx/CardsWS/","getLsh"));

call.addParameter(new QName("https://xx.xxx.xxx.xx/CardsWS/","CardNo"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName("https://xx.xxx.xxx.xx/CardsWS/","CardPwd"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName("https://xx.xxx.xxx.xx/CardsWS/","UserID"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName("https://xx.xxx.xxx.xx/CardsWS/","WebName"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName("https://xx.xxx.xxx.xx/CardsWS/","md5"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);

call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_ARRAY);
call.setUseSOAPAction(true);

call.setSOAPActionURI("https://xx.xxx.xxx.xx/CardsWS/getLsh");

String[] k = (String[])call.invoke(new Object[]{"902786799369393219","35442175","9","uk","4ece0696c974ee4daf6438d3a7967eae"});  
for(int i=0;i<k.length;i++)  
System.out.println(k[i]);
 

} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (RemoteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
错误信息:
- Exception:
org.xml.sax.SAXException: No deserializer for {http://www.w3.org/2001/XMLSchema}anyType
at org.apache.axis.encoding.DeserializerImpl.onStartElement(DeserializerImpl.java:485)
at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:428)
at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:976)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
at org.apache.axis.client.Call.invoke(Call.java:2272)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at test.main(test.java:73)
有知道怎么解决的吗?

------解决方案--------------------
you are using the wrong namespace.when you changed it,it would work fine.
------解决方案--------------------
前几天在开发中也遇到这类问题,原因就是服务器端将对象序列化为SOAP消息,到了客户端后进行反序列化,这个时候在SOAP消息中的某个元素是anyType
类型,但是和客户端在命名空间中的注册属性无法匹配,导致不能反序列化,大部分是命名空间的问题,你可以截获soap消息看一下,也可以调试源码查找是哪个字段反序列化失败
------解决方案--------------------