gpt4 book ai didi

jax-ws - ServerSOAPFaultException 以及如何读取它?

转载 作者:行者123 更新时间:2023-12-04 07:37:41 25 4
gpt4 key购买 nike

我做了一个请求,我的程序吐了出来

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 看到服务器发回
<?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 服务的服务器上的日志。

我注意到 soapenv:Fault 中的 xml 元素没有 xmlns。这是大多数 SOAP 错误的报告方式吗?这是一种非标准的做事方式吗?我是否必须完全依赖 mitmproxy 来调试 Web 服务的此类问题?

最佳答案

您必须创建一个 SOAPHandler 来拦截 SOAP 响应/故障。

使用本教程了解如何创建处理程序并将其注册到服务端口:

http://www.mkyong.com/webservices/jax-ws/jax-ws-soap-handler-in-client-side/

然后记得重写handleFault(SOAPMessageContext) 方法来拦截服务器故障。

关于jax-ws - ServerSOAPFaultException 以及如何读取它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25750446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com