java - 通过 https 使用 Axis1

标签 java web-services https wsdl axis

你好吗?

问题是,我们使用 Axis1 来使用基于 wsdl 的 Web 服务,当 WSDL 所在的 URL 使用普通的旧 HTTP 连接时,该服务工作正常,但是当它使用 SSL 安全连接时,当 Axis1 尝试下载 WSDL 文档内容时,它会带来 ConnectionException。

即使阅读了 XMLUtils.class 上的注释,Axis 开发人员也不确定它是否可以与 HTTPS 一起使用,因为它在第 810 行读取。

有什么办法可以解决这个问题吗?当他尝试在计算机上安装证书时,...jre7/lib/security/cacerts 并尝试信任所有证书,但问题仍然存在...

提前致谢。

编辑:

您可以使用以下代码重现异常:

InputSource source = new InputSource(urlWSDL);
DocumentBuilder db = DocumentBuilderFactoryImpl.newInstance().newDocumentBuilder();
Document doc = (Document) db.parse(source);

异常(exception)是:

java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at sun.security.ssl.SSLSocketImpl.connect(Unknown Source)
    at sun.security.ssl.BaseSSLSocketImpl.connect(Unknown Source)
    at sun.net.NetworkClient.doConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.<init>(Unknown Source)
    at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
    at java.net.URL.openStream(Unknown Source)
    at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
    at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)

最佳答案

问题出在公司代理上,所以我附加了:

System.setProperty("https.proxySet", "true");
System.setProperty("https.proxyHost", this.getConfiguracionProxy().getUrlProxy());
System.setProperty("https.proxyPort", this.getConfiguracionProxy().getPuertoProxy());

致:

System.setProperty("http.proxySet", "true");
System.setProperty("http.proxyHost", this.getConfiguracionProxy().getUrlProxy());
System.setProperty("http.proxyPort", this.getConfiguracionProxy().getPuertoProxy());

我通过 Wireshark 找到了解决方案。当我在 SoapUI 或 Web 浏览器上获取文件时,该 IP 不是我们应用程序使用的 IP(真实 IP)。然后我意识到我是在代理后面。

我从未使用过 Wireshark...我学到了很多东西,这是一件好事。

这将存储的代理配置设置为系统属性。

谢谢大家。

关于java - 通过 https 使用 Axis1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25620622/

相关文章:

java - Java 有类似 pkg-config 的东西吗?

java - Java中的实时绘图

ssl - Spinnaker 服务在 HTTPS 配置后未启动

ssl - Mule cxf :outbound-endpoint (client) and HTTPS/SSL 问题

java - 如何以 sbt 汇编后可访问的方式打开我的资源目录中的文件?

Java Web 项目未正确构建

java - WebService 未生成。/已生成

java - 是否可以从 Web 浏览器访问 JAX-WS?

java - Java 中 Microsoft Translation 的 400 响应代码

ios - 可以在客户端设备上建立没有证书的 https 连接吗?