我正在尝试在DocuSign API工作流程(http://iodocs.docusign.com/APIWalkthrough/requestSignatureFromDocument)中运行示例程序,以发送一个简单的文档来请求签名。我将我的值替换为程序中的选定变量(integratorKey到docContentType),并且能够在上周成功发送请求 。但是,当我运行示例程序时,特别是在第65行,调用conn.getResponseCode()方法时,我“无法找到有效的证书路径到请求的目标”错误。完整堆栈跟踪显示在下面:
Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1884)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:276)
at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:270)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1341)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:153)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:868)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:804)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1016)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1339)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1323)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:563)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1300)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at com.helloworld.RequestSignatureDocument.main(RequestSignatureDocument.java:62)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:385)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
at sun.security.validator.Validator.validate(Validator.java:260)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:326)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:126)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1323)
... 13 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:196)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:268)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:380)
... 19 more
我在DocuSign DevZone档案中查找了这个错误,并找到了这个引用:http://community.docusign.com/t5/DocuSign-API-Integration-Java-READ-ONLY/ValidatorException-while-sending-document-to-Docusign-demo/m-p/6771/highlight/true。答案指向另外两个链接,基本上需要下载一个名为InstallCert.java的Java程序并运行它以获取一些证书信息然后安装证书。它应该在本地安装证书,然后当你第二次运行程序时它应该识别证书。
那对我不起作用!
如何使示例RequestSignatureDocument.java程序运行?
http-colon中第65行附近的行 - // iodocs.docusign.com/APIWalkthrough/requestSignatureFromDocument如下所示: `
// obtain baseUrl and accountId values from response body
response = getResponseBody(conn);
baseURL = parseXMLBody(response, "baseUrl");
`
答案 0 :(得分:1)
我无法肯定地说这是我的问题的答案,因为我没有收到来自DocuSign的任何反馈,但经过两整天的搜索文档,博客,StackOverflow等,我以为我终于有了一个有效的解决方我按照How can I use certificate authentication with HttpsURLConnection?上发布的大多数步骤进行了操作,并且能够连接并发送文档以供签名。
感觉很好!但后来我尝试了上面帖子顶部引用的原始java程序,现在它工作正常,就像上周那样(但不是本周的前几天)。因此,我在SSL上所做的工作,将证书导入我的密钥库等都没有任何相关性或有意义。
我想我很难想到这一点,但我必须假设DocuSign上的某个人上周改变了一些东西,然后今天又改回来了。
如果我在这个假设上错了,而且DocuSign的某个人可以让我直截了当,那真的很棒。迟到总比不到好。但是直到某些事情发生变化,我的问题似乎已经解决了#34;。