我正在使用JAX WS调用SOAP Web服务。如果发生错误,我将从客户端得到以下响应(我在跟踪日志中看到了此响应):

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP- ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
    <SOAP-ENV:Fault>
        <faultcode>Error</faultcode>
        <faultstring>Error</faultstring>
        <SOAP-ENV:detail>
            <BLAServiceFault xmlns:ns="http://messages.testservice.com/TestService/2012/10">
                <ns:ReturnStatus>
                    <ns:ReturnCode>-97</ns:ReturnCode>
                    <ns:ReturnStatusSpecification>
                        <ns:SubCode xsi:nil="true"/>
                        <ns:Description>The price of productA must be higher than 30.</ns:Description>
                    </ns:ReturnStatusSpecification>
                </ns:ReturnStatus>
            </BLAServiceFault>
        </SOAP-ENV:detail>
    </SOAP-ENV:Fault>
</SOAP-ENV:Body>




如您所见,有用的错误在detail节点中:

<SOAP-ENV:Envelope>
<SOAP-ENV:Body>
    <SOAP-ENV:Fault>
        <SOAP-ENV:detail>


在我的客户端中,我得到了一个带有SOAPFault对象的SOAPFaultException。 SOAPFault对象似乎缺少我上面发布的节点。 SOAPFaultException.getFault()。getDetail()为空。异常是javax.xml.ws.soap.SOAPFaultException:错误。如何获得带有说明的局部节点?

谢谢。

最佳答案

看来来自该服务的消息不符合SOAP 1.1。他们从“详细信息”节点删除了前缀“ SOAP-ENV”后,它可以正常工作。

09-11 19:32