2012-10-04 37 views
0

我想要使用Java中的Web服務,並且正在使用JAX.WS.一切工作正常,直到我嘗試通過SSL(https)使用web服務。我已經使用keytool將該站點的證書添加到密鑰庫。仍然沒有成功。任何人都做過?該webservice來自第三方支付網關,如paypal-payflo等...所以定期web服務,其證書來自Verisign。任何提示都會有幫助。這是一個帶有wsdl的SOAP web服務。在Java中使用通過SSL的WebService

的錯誤跟蹤:螺紋

異常 「主要」 javax.xml.ws.WebServiceException:無法 訪問WSDL在: xxxxx.xxxxxx.xxx/creditcardWS/CreditCardService/v1?wsdl 。它失敗了 :Got Connection refused:從 xxxxxx.xxxxxx.xxx/creditcardWS/CreditCardService/v1?wsdl開始流時連接。在 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.int ernal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:96)

+1

詳細信息將幫助我們......你得到了什麼異常?你如何管理你的密鑰存儲,等? – home

+0

線程「main」中的異常javax.xml.ws.WebServiceException:無法訪問WSDL,網址爲:https://xxxxx.xxxxxx.xxx/creditcardWS/CreditCardService/v1?wsdl。失敗: \t Got拒絕連接:打開https://xxxxxx.xxxxxx.xxx/creditcardWS/CreditCardService/v1?wsdl。 \t com.sun.xml.internal.ws.wsdl.parse r.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:173) \t在com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:155) \t在com.sun.xml.internal。 ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:120) \t在..... – Clyde

+0

com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:260) \t在com.sun.xml.internal.ws.client.WSServiceDelegate。 (WSServiceDelegate.java:223) \t at com.sun.xml.internal.ws.client.WSServiceDelegate。 (WSServiceDelegate.java:171) \t at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:96) – Clyde

回答

1

是否將您自己的密鑰庫設置爲javax.net.ssl.trustStore幫助?

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

一定要檢查您是否可以從該路徑讀取(當前例子假定local.keystore是在類路徑中。

+0

我已經完成了它,我想我應該加密請求,這是爲什麼,我不知道如何去做。我知道用Apache HTTPComponents發佈表單的解決方案,但我不知道如何在這種類型的請求中進行加密。 – Clyde

+0

我認爲所有這些屬性應該設置在這些JAX.WS類的通信級別內部工作,而不是在System.setProperty()的JVM級別中... – Clyde