我想从 Websphere Application Server 访问通过 https 托管的 Web 服务。我正在使用以下方式进行 https 连接。
HttpsURLConnection connection= (HttpsURLConnection) new URL(wcfUrl).openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setAllowUserInteraction(false);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("foo",userId );
connection.setRequestProperty("bar", pwd);
connection.setRequestProperty("Content-Type","application/xml");
connection.connect();
当我尝试运行此代码时,我收到以下错误 * com.ibm.jsse2.util.g: PKIX path building failed: java.security.cert.CertPathBuilderException: PKIXCertPathBuilderImpl could not build a valid CertPath.; 内因是:java.security.cert.CertPathValidatorException: CN=GlobalSign Root CA, OU=Root CA, O=GlobalSign nv-sa, C=BE颁发的证书不可信;内部原因是:java.security.cert.CertPathValidatorException:证书链接错误 * 在我的本地服务器中导入签名者证书后(如此链接http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/中所述index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Finfo%2Faes%2Fae%2Ftsec_sslretrievesignersport.html) 我能够连接到远程服务器(通过 https 部署服务)。我可以通过java代码做同样的事情而不导入签名者证书吗?