Axis解析webservice异常 SAXException SimpleDeserializer encountered a child element

1. 场景

使用axis库调用webservice,报错:

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
	at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
	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:345)
	at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)

2. 分析

翻译下:

SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.

中文:

解析时遇到一个孩子节点,这个节点没有被预测到(是个意外,处理不了),在某方面正在努力解析。

理解就是解析一个xml节点时,遇到意外问题。

3. 解决问题

查看代码发现有:

		call.setReturnType(XMLType.SOAP_STRING);

这里意思是设置返回类型是字符串,通过SoapUI工具看返回值应该是一个xml文档,所以尝试将上面代码改为:

			call.setReturnType(XMLType.SOAP_DOCUMENT);

问题解决


如有问题请扫码联系我
在这里插入图片描述

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 代码科技 设计师:Amelia_0503 返回首页