2015-06-05 82 views
0

我尝试使用下面的代码连接到https web服务。无法解决PKIX路径构建失败

adapter.xml:

<connectivity> 
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType"> 
     <protocol>https</protocol> 
     <domain>somewhere.com</domain> 
     <port>443</port>  
     <connectionTimeoutInMilliseconds>30000</connectionTimeoutInMilliseconds> 
     <socketTimeoutInMilliseconds>30000</socketTimeoutInMilliseconds> 
     <maxConcurrentConnectionsPerNode>50</maxConcurrentConnectionsPerNode> 
    </connectionPolicy> 
</connectivity> 

impl.js:

{ 
    "errors": [ 
     "Runtime: Http request failed: 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" 
    ], 
    "info": [ 
    ], 
    "isSuccessful": false, 
    "warnings": [ 
    ] 
} 

我已经添加了:

function getTest() { 
    var input = { 
     method : 'GET', 
     returnedContentType : 'json', 
     path : "WS.svc" 
    }; 

    return WL.Server.invokeHttp(input); 
} 

不幸的是,当我尝试调用适配器出现此错误WS的公共证书(从浏览器访问并从证书详细信息中获取)到Program Files的Java文件夹中( C:\Program Files\Java\jdk_version\jre\lib\security),但问题仍然存在。

有什么建议吗?

+0

你的java文件夹中的程序文​​件?什么? –

+0

嗨伊丹请看我更新的帖子 – Rendy

+0

你从哪里读到这是你应该把它放在哪里? –

回答

0

使用MobileFirst Platform时,您遵循的说明不正确。
按照this user documentation topic(对于Worklight 6.2,但对MFPF 6.3及更高版本有效)中描述的步骤执行操作。

  • 不要从浏览器导出证书,因为此操作会添加浏览器元数据和其他应该不存在的工件。取而代之的是使用诸如OpenSSL之类的工具来获取证书(在文档中描述)
  • 然后,证书应该存储在应用程序服务器的密钥库中,而不是存储在Java的JVM中。
+0

是的伊丹我同意。我从我的JVM中删除了证书,并将证书添加到Conf文件夹中的MFP默认密钥库。但我使用从浏览器中提取的证书。通过使用openSSL导入证书后,我会让你知道结果。 – Rendy

+0

Idan,它可以与两种解决方案一起使用,但如您所建议的那样,我导入使用OpenSSL提取的证书。谢谢! – Rendy

+0

我使用http://serverfault.com/a/129505中的命令行导出证书并使用Firefox,然后导入它并将其验证到我的mfp密钥存储库中,如http://www.ibm.com/support/knowledgecenter中所述/SSZH4A_6.2.0/com.ibm.worklight.installconfig.doc/admin/t_configuring_SSL_WL_adapters_backend_servers_certificates.html但我仍然有javax.net.ssl.SSLHandshakeException异常。哪里不对了 ? – WiPhone

相关问题