使用客户端证书的SOAP请求

时间:2016-12-06 23:57:43

标签: java web-services soap saaj

我有一个包含证书

的trustStore
Keystore type: JKS
Keystore provider: SUN

Your keystore contains 2 entries

Alias name: mykey
Creation date: 06/12/2016
Entry type: trustedCertEntry

Owner: CN=***, O=***, L=***, ST=Ohio, C=US, SERIALNUMBER=***, OID.2.5.4.15=Private Organization
, OID.1.3.6.1.4.1.311.60.2.1.2=Ohio, OID.1.3.6.1.4.1.311.60.2.1.3=US
Issuer: CN=Go Daddy Secure Certificate Authority - G2, OU=http://certs.godaddy.com/repository/, O="GoDaddy.com, Inc.", L=Scottsdale, ST=Arizona, C=US
Serial number: ****
Valid from: Thu Jan 22 14:41:41 BRST 2015 until: Tue Jan 24 16:40:54 BRST 2017
(...)

然后我有SAAJ代码来执行请求(我正在使用IBM JDK)

System.setProperty("javax.net.ssl.trustStore","keystore.jks");
System.setProperty("javax.net.ssl.trustStorePassword","****");
System.setProperty("com.ibm.ssl.performURLHostNameVerification", "true");
System.setProperty("java.protocol.handler.pkgs","com.ibm.net.ssl.internal.www.protocol");

    Security.addProvider(new com.ibm.jsse.IBMJSSEProvider());

    // Create SOAP Connection
    SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
    SOAPConnection soapConnection = soapConnectionFactory.createConnection();

    String url = "https://****";
    SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);

但我收到错误消息

[ERROR ] SAAJ0009: Message send failed
[err] Error occurred while sending SOAP Request to Server
[err] com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed
[err] at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(Unknown Source)
[err] at wasdev.sample.servlet.SimpleServlet.tryMe(SimpleServlet.java:79)
[err] at wasdev.sample.servlet.SimpleServlet.doGet(SimpleServlet.java:206)
[err] at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
[err] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
[err] at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)
[err] at [internal classes]
[err] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
[err] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
[err] com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed
[err] Caused by:
[err] at java.lang.Thread.run(Unknown Source)
[err] at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(Unknown Source)
[err] Caused by:
java.security.cert.CertPathValidatorException: The certificate issued by CN=Go Daddy Secure Certificate Authority - G2, OU=http://certs.godaddy.com/repository/, O="GoDaddy.com, Inc.", L=***, ST=Arizona, C=US is not trusted; internal cause is:
[err] ... 30 more
[err] at com.ibm.jsse2.as.a(Unknown Source)
java.security.cert.CertPathValidatorException: Certificate chaining error
(...)

我的感觉是我在这里错过了一些步骤。

我正在运行一个bluemix自由运行时。

0 个答案:

没有答案