獲取javax.net.ssl.SSLHandshakeException做docusignapi handshade獲取JAV ax.net.ssl.SSLHandshakeException做docusignapi handshade
嘗試使用docusignapi登錄樣品拿到證書時錯誤時。
以下代碼是Docusign的示例。設置簽名者和Docusign配置對象。在執行setDefaultApiClient調用時會生成錯誤。
Exception in thread "main" com.sun.jersey.api.client.ClientHandlerException: jav
ax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKI
X path building failed: sun.security.provider.certpath.SunCertPathBuilderExcepti
on: unable to find valid certification path to requested target
at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle
(URLConnectionClientHandler.java:155)
at com.sun.jersey.api.client.Client.handle(Client.java:652)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:509)
at com.docusign.esign.client.ApiClient.getAPIResponse(ApiClient.java:563)
at com.docusign.esign.client.ApiClient.invokeAPI(ApiClient.java:595)
at com.docusign.esign.api.AuthenticationApi.login(AuthenticationApi.java:156)
** **新增
// initialize the api client ApiClient apiClient = new ApiClient();
apiClient.setBasePath(BaseUrl); // create JSON formatted auth header
String creds = "{\"Username\":\"" + UserName +
"\",\"Password\":\"" + Password + "\",\"IntegratorKey\":\"" +
IntegratorKey + "\"}";
apiClient.addDefaultHeader("X-DocuSign-Authentication", creds);
System.out.println("assign api client to the Configuration object ");
Configuration.setDefaultApiClient(apiClient); }
下面是用於實現docusign api調用的代碼 –
//初始化api客戶端 ApiClient apiClient = new ApiClient(); apiClient.setBasePath(BaseUrl); //創建JSON格式的驗證標題 String creds =「{\」用戶名\「:\」「+用戶名+」\「,\」密碼\「:\」「+ Password +」\「,\」IntegratorKey \ 「:\」「+ IntegratorKey +」\「}」; apiClient.addDefaultHeader(「X-DocuSign-Authentication」,creds); System.out.println(「將api客戶端分配給配置對象」); Configuration.setDefaultApiClient(apiClient); } –
歡迎來到StackOverflow!就像提示一樣,您可以編輯您的問題,以便所有代碼都在問題中。 –