Java 无类型的Apache Axis响应
我有一个使用axis的web服务客户端。它使用document/literal样式,应该有void响应,但是服务器坚持在soap主体内部发送头响应,如下所示Java 无类型的Apache Axis响应,java,web-services,axis,Java,Web Services,Axis,我有一个使用axis的web服务客户端。它使用document/literal样式,应该有void响应,但是服务器坚持在soap主体内部发送头响应,如下所示 <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <SOA
<?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)
有没有一种方法可以绕过此异常而不是使用InvokeOnway函数(我认为这不是一种好方法)?通过向服务添加输出消息来解决此问题
<xsd:element name="Code" type="codeDT" />
<xsd:complexType name="codeDT">
<xsd:sequence>
<xsd:any />
</xsd:sequence>
</xsd:complexType>
...
<wsdl:message name="Code">
<wsdl:documentation />
<wsdl:part name="Code" element="p1:Code" />
</wsdl:message>
...
只需将返回类型AXIS\u VOID更改为存根中的SOAP\u元素就可以了,但效果很好;这样,即使我不需要,我也可以得到值标签中的内容。通过向服务添加输出消息解决了这个问题
<xsd:element name="Code" type="codeDT" />
<xsd:complexType name="codeDT">
<xsd:sequence>
<xsd:any />
</xsd:sequence>
</xsd:complexType>
...
<wsdl:message name="Code">
<wsdl:documentation />
<wsdl:part name="Code" element="p1:Code" />
</wsdl:message>
...
只需将返回类型AXIS\u VOID更改为存根中的SOAP\u元素就可以了,但效果很好;这样,即使我不需要它,我也可以得到值标签中的内容