gpt4 book ai didi

Fiddler 检查传出 SOAP 请求的 Java 设置?

转载 作者:行者123 更新时间:2023-11-28 22:19:15 26 4
gpt4 key购买 nike

我正在尝试调试发送到第三方 Web 服务的 SOAP 请求。我的客户端代码(在我的本地机器上运行的代码)是使用 wsimport 生成的。我正在尝试配置 Fiddler 以拦截我的传出 SOAP 请求,但没有成功。这是我到目前为止所做的:

  1. WinINET LAN 设置指向本地主机 (127.0.0.1:8888),Fiddler 正在运行并捕获流量。由于我的 Web 服务使用的是 HTTPS,因此我的 HTTPS 请求正在被 Fiddler 解密。此时我对 3rd 方 URL 的请求根本没有出现。我收到一个堆栈跟踪错误,告诉我 Web 服务由于内部错误而无法处理请求(这就是我调试我的请求的原因 - 因为它是第三方,所以我无权访问 Web 服务日志)。

  2. 然后我将以下代码添加到调用网络服务的方法中:

    System.setProperty("http.proxyHost", "127.0.0.1");
    System.setProperty("https.proxyHost", "127.0.0.1");
    System.setProperty("http.proxyPort", "8888");
    System.setProperty("https.proxyPort", "8888");

当我执行包含此代码的代码时,我收到以下错误:

org.apache.jasper.JasperException: javax.xml.ws.WebServiceException: Failed to access the WSDL at: <wsdl_url>. It failed with: 
Got sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target while opening stream from <wsdl_url>.

但是在 Fiddler 中,我得到一个似乎未完成的请求条目(抱歉 - Fiddler 的新手)。主机被列为“Tunnel to”并且显示为灰色。在 Fiddler 日志中,我收到此错误:

!SecureClientPipeDirect failed: System.Security.Authentication.AuthenticationException A call to SSPI failed, see inner exception. < An unknown error occurred while processing the certificate on pipe to (CN=<wsdl_base_url>, O=DO_NOT_TRUST, OU=Created by http://www.fiddler2.com).

对我来说,似乎我的 Fiddler 和我的代理配置正确,但我在 Java 中遗漏了一些东西。我忍不住觉得我在这里错过了一个关键步骤,所以任何建议都将不胜感激。谢谢!

编辑:我是否需要使用设置了 -httpproxy 选项的 wsimport 生成新的 Java 代码?

最佳答案

您需要将 Fiddler 的根证书添加到 Java Key Store。 Java 不使用系统的证书存储,因此 Fiddler 将自己放在那里并不能为您解决问题。

通过单击工具 > Fiddler 选项 > HTTPS 中的 Export Root Certificate 获取 Fiddler 的证书。然后导入证书:http://azure.microsoft.com/en-us/documentation/articles/java-add-certificate-ca-store/#to-add-a-certificate-to-the-cacerts-store

关于Fiddler 检查传出 SOAP 请求的 Java 设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28953466/

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