Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JAX-WS SOAP错误-分析SOAPFaultException中错误的详细信息_Java_Web Services_Soap_Jax Ws - Fatal编程技术网

Java JAX-WS SOAP错误-分析SOAPFaultException中错误的详细信息

Java JAX-WS SOAP错误-分析SOAPFaultException中错误的详细信息,java,web-services,soap,jax-ws,Java,Web Services,Soap,Jax Ws,如果是错误的soap请求,我需要获得错误的详细信息 我正在使用JAX-WS创建web服务客户端。我的问题是,在错误事务期间,web服务客户端能够捕获SOAPFaultException,但没有详细信息: javax.xml.ws.soap.SOAPFaultException: Component Interface API. at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java

如果是错误的soap请求,我需要获得错误的详细信息

我正在使用JAX-WS创建web服务客户端。我的问题是,在错误事务期间,web服务客户端能够捕获SOAPFaultException,但没有详细信息:

javax.xml.ws.soap.SOAPFaultException: Component Interface API.    at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
如果我通过SOAPUI发送请求,我可以获得响应,详细信息如下:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">   <SOAP-ENV:Body>
     <SOAP-ENV:Fault>
        <faultcode>SOAP-ENV:Server</faultcode>
        <faultstring>Component Interface API.</faultstring>
        <detail>
           <IBResponse type="Error">
              <DefaultTitle>Integration Broker Response</DefaultTitle>
              <StatusCode>20</StatusCode>
              <MessageSetID>180</MessageSetID>
              <MessageID>117</MessageID>
              <DefaultMessage>You are allowed to claim one meal per day</DefaultMessage>
              <MessageParameters>
                 <keyinformation>
                    <EMPLID>112233</EMPLID>
                 </keyinformation>
              </MessageParameters>
           </IBResponse>
        </detail>
     </SOAP-ENV:Fault>   </SOAP-ENV:Body> </SOAP-ENV:Envelope>

SOAP-ENV:服务器
组件接口API。
集成代理响应
20
180
117
你可以要求每天吃一顿饭
112233

我是否错过了web服务客户端中的任何配置?非常感谢。

要从
javax.xml.ws.soap.SOAPFaultException
获取详细信息,请执行以下操作:

try {
    //... invoke service via client
} catch (javax.xml.ws.soap.SOAPFaultException soapFaultException) {
    javax.xml.soap.SOAPFault fault = soapFaultException.getFault(); //<Fault> node
    javax.xml.soap.Detail detail = fault.getDetail(); // <detail> node
    Iterator detailEntries = detail.getDetailEntries(); //nodes under <detail>
    //application / service-provider-specific XML nodes (type javax.xml.soap.DetailEntry) from here
}
试试看{
//…通过客户端调用服务
}catch(javax.xml.ws.soap.SOAPFaultException-SOAPFaultException){
javax.xml.soap.SOAPFault fault=soapFaultException.getFault();//节点
javax.xml.soap.Detail Detail=fault.getDetail();//节点
迭代器detailEntries=detail.getDetailEntries();//下的节点
//从这里输入特定于应用程序/服务提供商的XML节点(类型javax.XML.soap.DetailEntry)
}
请参阅关联的javadocs,以了解您可以从这些构造中获得的方法/信息:


您需要删除行soapFaultException().getFault()上soapFaultException之后的括号。我试图编辑,但编辑的时间不够长