JDeveloper证书问题

时间:2018-11-21 09:08:01

标签: java ssl ssl-certificate x509certificate jdeveloper

我正在使用 JDeveloper 12c 尝试连接到安全的Web服务SSL。

我将证书RootCA和中间证书都添加到了我的 JAVA_HOME 目录中的受信任存储中。

检查以下我的源代码:

    SSLSocketFactory sslSocketFactory = sslcontext.getSocketFactory();
    HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
    HttpsURLConnection httpsConn = (HttpsURLConnection)url.openConnection();
     ByteArrayOutputStream bout = new ByteArrayOutputStream();
     String xmlInput = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ws=\"http://ws.gdsp.vodafone.com/\">\n" + 
     "   <soapenv:Header>\n" + 
     "      <ws:gdspHeader>\n" + 
     "         <gdspCredentials>\n" + 
     "                    <password>***</password>\n" + 
     "            <userId>zainmdw</userId>\n" + 
     "         </gdspCredentials>\n" + 
     "      </ws:gdspHeader>\n" + 
     "   </soapenv:Header>\n" + 
     "   <soapenv:Body>\n" + 
     "      <ws:submitReportRequest>\n" + 
     "         <reportName>" + reportname + "</reportName>\n" + 
     "         <reportFormat>XML</reportFormat>\n" + 
     "                  <reportParameters>\n" + 
     "               <parameter>\n" + 
     "               <name>CUSTOMER_CODE</name>\n" + 
     "               <value>" + customer_code + "</value>\n" + 
     "            </parameter>\n" + 
     "            <parameter>\n" + 
     "               <name>PERIOD_START</name>\n" + 
     "               <value>" + period_start + "</value>\n" + 
     "            </parameter>\n" + 
     "         </reportParameters>\n" + 
     "         <notificationType>N</notificationType>\n" + 
     "        <notificationUser>zainmdw</notificationUser>\n" + 
     "         <reportPriority>1</reportPriority>\n" + 
     "      </ws:submitReportRequest>\n" + 
     "   </soapenv:Body>\n" + 
     "</soapenv:Envelope>";          
     byte[] buffer = new byte[xmlInput.length()];
     buffer = xmlInput.getBytes();
     bout.write(buffer);
     byte[] b = bout.toByteArray();
     String SOAPAction =
     "https://m2mprdapi.vodafone.com:11851/GDSPWebServices/ReportRequestService";
     // Set the appropriate HTTP parameters.
     httpsConn.setRequestProperty("Content-Length",
     String.valueOf(b.length));
     httpsConn.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
     httpsConn.setRequestProperty("SOAPAction", "submitReportRequest");
     httpsConn.setRequestMethod("POST");
     httpsConn.setDoOutput(true);
     httpsConn.setDoInput(true); 
     OutputStream out = httpsConn.getOutputStream();

这是跟踪:

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
sun.security.ssl.Alerts.getSSLException(Alerts.java:192)    StackTraceElement
sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1949)   StackTraceElement
sun.security.ssl.Handshaker.fatalSE(Handshaker.java:302)    StackTraceElement
sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)    StackTraceElement
sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1514) StackTraceElement
sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:216) StackTraceElement
sun.security.ssl.Handshaker.processLoop(Handshaker.java:1026)   StackTraceElement
sun.security.ssl.Handshaker.process_record(Handshaker.java:961) StackTraceElement
sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1062)  StackTraceElement
sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) StackTraceElement
sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)  StackTraceElement
sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)  StackTraceElement
sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)   StackTraceElement
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)  StackTraceElement
sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316)   StackTraceElement
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291)    StackTraceElement
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)  StackTraceElement
sa.zainksa.BusinessLogic.VF_APIs.SendSoapRequest(VF_APIs.java:149)  StackTraceElement
sa.zain.mdwSessionEJBClient.main(mdwSessionEJBClient.java:49)   StackTraceElement

我做了很多研究,为这种例外情况找到解决方案,但没有运气找到解决方案。

有人可以帮助我吗?

0 个答案:

没有答案