Search code examples
javaeclipsesslkeystore

How to generate a web service client in Eclipse from a wsdl at an https address?


I can generate a client from

http://localhost:8080/service?wsdl

just fine, but now I want to generate a client from

https://localhost:8081/service?wsdl

and Eclipse says the location is invalid, and when Eclipse makes the attempt my Jetty server says

javax.net.ssl.SSLException: Received fatal alert: certificate_unknown

I can easily navigate to the wsdl in my browser after confirming the security exception, so it's definitely there.

I've tried downloading the wsdl to my local file system, but I still can't generate it from there because the wsdl contains a reference to other https locations, eg.

<xsd:import namespace="http://my.service.namespace/" schemaLocation="https://localhost:8081/serviceSchema?xsd=1"/>

I've modified eclipse.ini to contain the following lines:

-Djavax.net.ssl.trustStore="/path/to/my/truststore/.keystore"
-Djavax.net.ssl.trustStorePassword="mytruststorepassword"
-Djavax.net.ssl.keyStore="/path/to/my/keystore/.keystore"
-Djavax.net.ssl.keyStorePassword="mykeystorepassword"

to no avail. Eclipse does not appear to have any preference settings related to this either. Is there any way to do this through eclipse, or will I have to use some external tool?

EDIT: For others with the same issue, here's how I solved it.

  1. Navigate to the wsdl in your browser, and download it to your file system.
  2. Navigate to anything it depends on, and download it as well.
  3. Open the dependency you just downloaded with a browser and copy its new location, eg.

    file:///path/to/my/schema/service.xsd

  4. Paste this into your downloaded wsdl file where its https address is, repeat for any other schema, and save.
  5. Copy the file location of your wsdl file, as above
  6. In Eclipse, generate a New->Other...->Web Service Client and paste the file location into the service definition, and it should work. Thanks to everyone for the help!

Solution

  • Save the wsdl to your local file system and generate from there, it seems it is a bug at Eclipse, and pls check this link too.