ServerSOAPFaultException以及如何读取? [英] ServerSOAPFaultException and how to read it?
问题描述
我发出了一个请求,程序退出了
I did a request and my program spit out
WARNING: Input Action on WSDL operation Search and @Action on its associated Web Method search did not match and will cause problems in dispatching the requests
Exception in thread "main" com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Client error Please see the server log to find more detail regarding exact cause of the failure.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:124)
at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)
....
我通过mitmproxy看到服务器发回了邮件
I see via mitmproxy that the server sent back
<?xml version='1.0' encoding='utf-8'?>
<!--pageview_candidate-->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>Client error</faultstring>
<faultactor>http://api.bing.net:80/soap.asmx</faultactor>
<detail>
<Errors xmlns="http://schemas.microsoft.com/LiveSearch/2008/03/Search">
<Error>
<Code>1001</Code>
<Message>Required parameter is missing.</Message>
<HelpUrl>http://msdn.microsoft.com/en-us/library/dd251042.aspx</HelpUrl>
<Parameter>SearchRequest.AppId</Parameter>
</Error>
<Error>
<Code>1001</Code>
<Message>Required parameter is missing.</Message>
<HelpUrl>http://msdn.microsoft.com/en-us/library/dd251042.aspx</HelpUrl>
<Parameter>SearchRequest.Sources</Parameter>
</Error>
</Errors>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
如何阅读第一部分并获得第二部分的详细信息?我无权访问服务器日志,例如托管Web服务的服务器上的日志.
How do I read the first bit and get the details in the second bit? I don't have access to the server log, as in, the log on the server that hosts the web service.
我注意到soapenv:Fault内的xml元素没有xmlns.这是大多数SOAP错误被报告回来的方式吗?这是一种非标准的做事方式吗?我是否必须完全依靠mitmproxy来调试Web服务中的此类问题?
I notice that the xml elements inside of soapenv:Fault don't have an xmlns. Is this how most SOAP errors are reported back? Is this a nonstandard way to do things? Am I going to have to rely completely on mitmproxy to debug these kinds of problems with web services?
推荐答案
您必须创建一个SOAPHandler来拦截SOAP响应/故障.
You must create a SOAPHandler to intercept the SOAP response/fault.
使用本教程来学习如何创建处理程序并将其注册到服务端口:
Use this tutorial to learn how to create an handler and register it to the service port:
http://www .mkyong.com/webservices/jax-ws/jax-ws-soap-handler-in-client-side/
然后请记住重写handleFault(SOAPMessageContext)方法以拦截服务器故障.
Then remember to override the handleFault(SOAPMessageContext) method to intercept server faults.
这篇关于ServerSOAPFaultException以及如何读取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!