我正在编写一个应用程序,通过SOAP Web服务与另一个应用程序进行通信。我为我的应用程序配置了代理服务器并发送了SOAP信封。我正在使用Axis2。以下是代码:
SOAPConnection conn = SOAPConnectionFactoryImpl.newInstance().createConnection();
SOAPMessage sm = conn.call(smsg, endpoint);
其中smsg是SOAPMessage,端点是SOAP端点字符串。
我的SOAP包围是:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:x="http://www.xxxx.com/test">
<soapenv:Header></soapenv:Header>
<soapenv:Body>
<x:insert>
<opened_by>John</opened_by>
<caller_id></caller_id>
<category>request</category>
<assignment_group>Itil</assignment_group>
<contact_type>email</contact_type>
<impact>3</impact>
<urgency>3</urgency>
<state>1</state>
<short_description>Request: 7 </short_description>
<description>This is test
Source Data:
type=
id=
name=
</description>
</x:insert>
</soapenv:Body>
</soapenv:Envelope>
我收到以下错误:
Unable to parse SOAP document
javax.xml.soap.SOAPException: Unable to parse SOAP document
at org.apache.axis2.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:209)
Caused by: org.apache.axis2.AxisFault: Unable to parse SOAP document
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:205)
... 82 more
更新:在运行应用程序的tomcat上配置了代理。