0
votes

I tried to generate web service classes from following url https://example.com:20008/mws-ws/services/TL_M3_PRSystem_Integration?wsdl this web service is working under a specific VPN.

I used apache cxf to generate java classes for this web service.

Then I got following error on cmd,

enter image description here

I could generate classes when I used an unsecured soap web service.

Anyone have idea about this ?

1
Do you have access to the VPN where the WS https is hosted? The WSDL page shows up when you try to open at browser (ie. Chrome)?Rodrigo Gomes
@RodrigoGomes : Yes , But I have to try several times to get it on browser.Terance Wijesuriya
Try to reach the page via postman and take a look at the response header when you don't have success at view the WSDL. This approach can give you a better idea of what is happening. You shouldn't have any interoperability to access the WDSL via browser, if you are connected to VPN. Make sure all your requests is going thru the VPN too!Rodrigo Gomes

1 Answers

2
votes

It's most likely signed by a self-signed (untrusted) certificate. The easiest way is to add this certificate to the cacerts java keystore or add it to a custom store and run wsimport with javax.net.ssl.trustStore property set to the custom store.

  1. Go to url in Chrome and use the Security tab in Dev tools to export the certificate to a file.
  2. Use the keystore tool to import the certificate into cacerts keystore.

In the terminal:

$JAVA_HOME/bin/keytool -import -alias MyCustomCert -keystore $JAVA_HOME/jre/lib/security/cacerts -file ~/path/to/saved/cert

or on Windows:

%JAVA_HOME%\bin\keytool -import -alias MyCustomCert -keystore %JAVA_HOME%\jre\lib\security\cacerts -file C:\whereever\the\file\is

Make sure JAVA_HOME environment variable is defined and the command prompt you're using has permission to write to the %JAVA_HOME%\jre\lib\security\cacerts file.