简体   繁体   中英

SSLHandshakeException dynamic web project java

In my Wicket application I would like to send data to a wsdl-endpoint with soap. To accomplish this, I made a dynamic web project in Eclipse (with Axis2). I get an error while connecting to the endpoint. The error is:

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

The endpoint expects a username and password, with a preemptive connection.

This is my code:

Deliver deliver = new Deliver();

XmlDataList dataList = new XmlDataList();
dataList.addXmlData(XML);   
deliver.setXmlDataList(dataList);
Stubstub = new Stub();

Authenticator basicAuthenticator = new HttpTransportProperties.Authenticator();
List<String> schemes= new ArrayList<String>();
authSchemes.add(Authenticator.BASIC);
basicAuthenticator.setAuthSchemes(schemes); 
basicAuthenticator.setUsername("UName");
basicAuthenticator.setPassword("Pwd");
basicAuthenticator.setPreemptiveAuthentication(true);

stub._getServiceClient().getOptions().setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, basicAuthenticator);

How can I set the preemptive conditions for connecting to a wsdl (https)? Can someone explain to me how this works?

Thanks!

The error message means that your endpoint uses a probably self-signed certificate. You have to add this certificate to your local keystore in order to accept it. See the following question: Resolving javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed Error?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM