Tuesday, September 15, 2015

Call HTTPS Wsdl from JAVA ( SSL Certificate import in JAVA)

Requirement:

Application should call 3rd Party WSDL which is running on SSL port.

Problem:

Created Stub with Axis2. And tried to invoke WSDL but it throwing below exception : 

Unable to sendViaPost to url[WSDLURL]: org.apache.axis2.AxisFault: Connection has been shutdown: 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 org.apache.axis2.AxisFault.makeFault(AxisFault.java:430) [:1.6.2]
at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:78) [:]
at org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84) [:]

Solution:

1. Download Certificate by opening WSDL URL on browser with proper name.
2. Run Command prompt as Administrator
3. Run below command

keytool -import -trustcacerts -file -alias -keystore %JAVA_HOME%/jre/lib/security/cacert

Above command will prompt for password. Default password is "changeit"  (without double quote)

Run your stub again... Hurray it's working !!!!

Assumption:

1. %JAVA_HOME% path pointing to same JDK to which your WSDL Client Stub getting executed.
2. is pointing to your downloaded certificate like C:/test.cer
3. can be your custom ALIAS.






7 comments:

Unknown said...

Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon. Unwashed Pet Flakes

Swethapriya said...

i like that post all peoples like that post,because of all given information was wonderful and it's very helpful for me.

Best Dental Clinic in OMR

Unknown said...

In our Gmail Support Service, we provide the best techniques to resolve each and every Gmail problem of all users. From last so many years, our Gmail support services and method of handling the customer’s technical problems has kept us on distinct platform. In our Gmail Experts Group, The technicians have made the usage of services so much easier that wherever, whenever user face any Gmail technical error, they can get in reach with Toll free Gmail customer service number and their concerns will be equally handled. We impart services of Gmail account setting, chat issues, Gmail account recovery, Gmail Password Recovery, Gmail sync issues and much more. Read More: How To Contact Gmail Customer Service

Hannah Baker said...

i am looking for web development company can you suggest me a better one??

Norton Support said...

McAfee Support
Protect Your Computer , Network, Social Media Account And all other from hackers, infection ,Virus and other online threats, Mcafee Total Protection Software very Important to Activate or Setup with the Official Link McAfee.com/Activate

Facing Issues With Antivirus? McAfee Support Is Just A Call Away with the following link www.McAfee.com/Activate to get Total protection Online instant Help

Laura K. Pitts said...

Appreciate you sharing, great article.Really looking forward to read more. Really Great.
clipping path service

Barbara Pantuso said...

Take Pleasure in the Region of Video Game

Contributors