Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error trying to access secure webservice

Elkgrove65Apr 27 2016 — edited May 2 2016

Hi all,

I need help to figure out my current problem and I'm out of idea.  I'm using JDeveloper 11g Release 1(11.1.1.9.0) trying to call a external webservice.  I extracted the self-signed certificate from webservise's WSLD then imported and created a jks file.  HTTP Analyzer has no problem getting the information back from the webservice but when I try to run this code


    public static void main(String[] args) {
        try {
            dataService = new DataService();
            DataServiceClient dataServiceClient = dataService.getWSHttpBinding_DataServiceClient();

            Map<String, Object> requestContext = ((BindingProvider) dataServiceClient).getRequestContext();
            setPortCredentialProviderList(requestContext);

            // Add your code to call the desired methods.
            System.out.format("\nweather2----");
           
        } catch (Exception ex) {
            ex.printStackTrace();
        }


I got the error below.  Thanks.


C:\Oracle\Middleware\jdk160_29\bin\javaw.exe -client -classpath C:\JDeveloper\mywork\CHPWebService\.adf;C:\JDeveloper\mywork\CHPWebService\CHPWebServiceProxy\classes;C:\oracle\Middleware\wlserver_10.3\server\lib\weblogic.jar;C:\oracle\Middleware\oracle_common\modules\oracle.jrf_11.1.1\jrf.jar;C:\oracle\Middleware\modules\com.oracle.toplink_1.1.0.0_11-1-1-6-0.jar;C:\oracle\Middleware\modules\org.eclipse.persistence_1.2.0.0_2-3.jar;C:\oracle\Middleware\modules\com.bea.core.antlr.runtime_2.7.7.jar;C:\oracle\Middleware\modules\javax.persistence_1.1.0.0_2-0.jar -Djavax.net.ssl.trustStore=C:\oracle\Middleware\wlserver_10.3\server\lib\CHP.jks -Dhttp.proxyHost=localhost -Dhttp.proxyPort=8099 -Dhttp.nonProxyHosts=~localhost -Dhttps.proxyHost=localhost -Dhttps.proxyPort=8099 -Dhttps.nonProxyHosts=~localhost -Djavax.net.ssl.trustStore=C:\oracle\Middleware\wlserver_10.3\server\lib\CHP.jks org.tempuri.WSHttpBinding_DataServiceClientClient
Apr 27, 2016 6:41:06 AM weblogic.wsee.jaxws.spi.WLSProvider createServiceDelegate
WARNING: Could not read WSDL Definition from URL wsdlDocumentLocation: 2 counts of InaccessibleWSDLException.

javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://ciresexchangetest.chp.ca.gov/CIRESExchangeService/DataService.svc?wsdl. It failed with:
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target.
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:172)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:153)
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:284)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:246)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:197)
at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:187)
at weblogic.wsee.jaxws.spi.WLSServiceDelegate.<init>(WLSServiceDelegate.java:86)
at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.<init>(WLSProvider.java:632)
at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:143)
at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:117)
at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:88)
at javax.xml.ws.Service.<init>(Service.java:56)
at org.tempuri.DataService.<init>(DataService.java:66)
at org.tempuri.WSHttpBinding_DataServiceClientClient.main(WSHttpBinding_DataServiceClientClient.java:36)
Caused by: 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 com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1731)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:241)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:235)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1206)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:136)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:593)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:529)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:925)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1170)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1197)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1181)
at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:434)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:166)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1172)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at java.net.URL.openStream(URL.java:1010)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:856)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:295)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:138)
... 12 more
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:323)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:217)
at sun.security.validator.Validator.validate(Validator.java:218)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:126)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:209)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:249)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1185)
... 27 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:174)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:238)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:318)
... 33 more
Process exited with exit code 0.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 30 2016
Added on Apr 27 2016
7 comments
1,839 views