1
我試圖訪問一個Web服務,它具有從獨立Java程序啓用SSL的功能。我能夠從WSDL生成客戶端,但是當我嘗試調用Web服務時,我得到了SSL握手問題。下面是Java代碼從java中調用HTPS WebService
TestWebService sh = (TestWebService) shs.getTestWebServiceExportTestWebServiceHttpPort();
BindingProvider port = (BindingProvider)sh;
port.getRequestContext().put(BindingProvider.
ENDPOINT_ADDRESS_PROPERTY, args[0]);
System.out.println(((BindingProvider)sh).toString());
是讓說https://service.test.com/sca/TestWebService?wsdl
下面是錯誤消息的URL
未能在訪問WSDL:
https://service.testwebservice.com/TestWebServiceExport?wsdl. It failed with:
Got com.ibm.jsse2.util.j: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; internal cause is:
java.security.cert.CertPathValidatorException: The certificate issued by CN=Corp Production Root CA V1, O=Cord Inc. is not trusted; internal cause is:
java.security.cert.CertPathValidatorException: Certificate chaining error while opening stream from https://service.testwebservice.com/TestWebServiceExport?wsdl.
我已經安裝了ceritificate在IE瀏覽器從網站,但仍然沒有運氣。
謝謝,這個解決方案的工作原理,但我必須添加「java -Djavax.net.ssl.trustStore = mykeystore ... MyClientClass」java VM參數有沒有什麼辦法可以避免這我看到了不使用這個的程序。 –
cacerts文件是虛擬機的默認信任存儲 - 只要您已將cert添加到正確的cacerts文件中,您不必手動指定trustStore作爲VM參數。如果您不得不指定文件,那麼可能您可能已將證書添加到cacerts以進行不同的java安裝 –