Apache Axis 响应无类型
我有一个使用 axis 的网络服务客户端。它使用文档/文字样式并且应该具有无效响应,但是服务器坚持在肥皂体内发送标头响应,如下所示
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Code>
<SOAP-ENV:Value>HTTP/1.1 200 OK</SOAP-ENV:Value>
</SOAP-ENV:Code>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
当然客户端正在引发反序列化器异常,如下所示
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: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:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
有没有办法绕过此异常而不是使用 invokeOneWay 函数(我认为这不是一个好方法)?
I have a web service client using axis. It's using document/literal style and supposed to have void response however the server insists on sending header response inside of soap body as following
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Code>
<SOAP-ENV:Value>HTTP/1.1 200 OK</SOAP-ENV:Value>
</SOAP-ENV:Code>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
And of course client is raising deserializer exception as following
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: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:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
Is there a way to bypass this exception instead of using invokeOneWay function (which is not a good way I suppose)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过向服务添加输出消息解决了这个问题。
只需将存根内的返回类型 AXIS_VOID 更改为 SOAP_ELEMENT 就可以很好地工作,但是哦,好吧;这样我就可以获取值标签内的内容,即使我不需要它。
Solved it by adding output messages to service.
Just changing return type AXIS_VOID to SOAP_ELEMENT inside stub works fine but oh well; this way I can get what's inside of value tag even though I don't need it.