java - 在 Java 中通过 SSL 使用 WebService

标签 java web-services

我想使用 Java 中的 Web 服务,并且我正在使用 JAX.WS。一切工作正常,直到我尝试通过 SSL (https) 使用 Web 服务。我已使用 keytool 将站点的证书添加到 keystore 中。仍然没有成功。以前有人做过吗?该网络服务来自第三方支付网关,例如 paypal-payflo 等......因此,其证书来自 Verisign 的常规网络服务。任何提示都会有所帮助。它是一个带有 wsdl 的 SOAP Web 服务。

错误跟踪:

Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access the WSDL at: xxxxx.xxxxxx.xxx/creditcardWS/CreditCardService/v1?wsdl. It failed with: Got Connection refused: connect while opening stream from xxxxxx.xxxxxx.xxx/creditcardWS/CreditCardService/v1?wsdl. at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLPars‌​er.java:173) at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.ja‌​va:155) at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.ja‌​va:120) at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.jav‌​a:260) at com.sun.xml.internal.ws.client.WSServiceDelegate.(WSServiceDelegate.java:2‌​23) at com.sun.xml.internal.ws.client.WSServiceDelegate.(WSServiceDelegate.java:1‌​71) at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java‌​:96)

最佳答案

将您自己的 keystore 设置为 javax.net.ssl.trustStore 有帮助吗?

String keystorePath = "local.keystore";
System.setProperty("javax.net.ssl.trustStore", keystorePath);

请务必检查是否可以从该路径读取(当前示例假设 local.keystore 位于类路径中。

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

相关文章:

java - 将最大的产品计数器初始化为 "infinitely"小数

java - Java 中的 searchFromRecord(String, String) 无法正常工作

Java - 正则表达式 - 捕获 ""之间的组

c# - jsTree 3.0.2 - 如何将参数传递给 aspx webmethod

PHP:XML 文件到字符串,使用 asXML() 更快的 file_get_contents 或 simplexml_load_file

web-services - Jboss eap 6.1 : Failed to start the service :Could not resolve a binding for http://java. sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/

java - 应该在 applicationContext 和 dispatcherServlet 中声明哪些 beans

javascript - AngularJS 没有得到 API 响应

c# - WCF 无法解析 Java Soap 响应

java - 从命令行 : StackOverFlow 在 Eclipse 中编译但不使用 Javac