java - SOAPFaultException 详细信息为 null

标签 java soap jax-ws websphere-7 soapfault

我正在使用 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>

正如您所看到的,有用的错误位于详细信息节点中:

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

在我的客户端中,我收到一个 SOAPFaultException,它有一个 SOAPFault 对象。 SOAPFault 对象似乎缺少我上面发布的节点。 SOAPFaultException.getFault().getDetail() 为 null。异常是 javax.xml.ws.soap.SOAPFaultException:错误。如何获取带有描述的详细节点?

谢谢。

最佳答案

来自该服务的消息似乎不符合 SOAP 1.1 标准。当他们从“detail”节点中删除前缀“SOAP-ENV”后,它就可以正常工作了。

关于java - SOAPFaultException 详细信息为 null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23496112/

相关文章:

php - Soapclient 不解析 WSDL(使用 SSL 证书和 wsse)

xml - 我自己的 SOAP 代码?

java - 用于使用消息驱动的 bean 和 Web 服务对 Java EE 应用程序进行功能测试的工具

javascript - SharePoint 获取当前用户帐户名?

java - 无法将 Java Web 服务部署到 Glassfish

ssl - 尝试从 JAX-WS 调用 asmx https Web 服务时连接超时

java - 如何使用 Java 编写 Selenium Web 驱动程序中复选框的脚本

java - 如何在 spring-security 中的另一个过滤器之前添加过滤器?

java - 改进验证检查的构建器模式?

java - 链接两个作业时未调用 Hadoop 第二个 reducer