Web Services javax.xml.soap.SOAPException:无法解析SOAP文档

kb5ga3dv  于 2023-01-26  发布在  Java
关注(0)|答案(1)|浏览(191)

我正在编写一个通过SOAP Web服务与另一个应用程序通信的应用程序。我已经为我的应用程序配置了代理服务器并发送了SOAP信封。我使用的是Axis2。下面是代码:

SOAPConnection conn = SOAPConnectionFactoryImpl.newInstance().createConnection();
SOAPMessage sm = conn.call(smsg, endpoint);

其中,smsg是SOAPMessage,endpoint是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上配置了代理。

knsnq2tg

knsnq2tg1#

我以前也遇到过类似的问题,是你们肥皂剧的第一句台词引起的

<?xml version="1.0" encoding="UTF-8"?>

相关问题