Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JAX-WS https client  RSS feed

 
Ola Daniel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to create a jax-ws client to connect to a wsdl on a https server.

Is there a way to make the connection without passing environment variables -Djavax.net.ssl.keyStore and -Djavax.net.ssl.keyStorePassword.

The webservice(.NET) developer is not willing to give me his certifcate to make the connection. Can anyone help please?
 
Dave Trower
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same issue recently. The client should not mind as long as you only have the public part of the certificate.
Here is what you can do:
Note this works only if you use Microsoft Explorer:
1) Point your web browser at the https address the client gave you.
2) You should see the warning box "Security Alert"
3) Click on the "View Certificate" button.
4) Click on "Install Certificate"
5) Then click on "Tools/Internet Options.
6) Select "content" tab.
7) Click Certificates.
8) The click the "Other People" tab.
9) Export it to your local machine.

Now import the certificate into a keystore file. You will be asked if you should trust this certifcate. Say Yes.
Then use the options you described and it should work.
Let me know if you have any problems.
 
Ola Daniel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. My browser did not ask me whether or not to accept the certificate. Im guessing because i have probably already accepted the certificate in a previous session. When i go to the content tab to view certificates there is none under other people Tab. However under the Intermediate Certification Authorities. There is one. I go ahead and export that one to a file. But its not working.

Any other ideas please?

By the way im trying to generate the client classes using wsimport.
 
Dave Trower
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now that the certificate is on your local machine, import it to a keystore file:
keytool -import -file client.cer -keystore client.ks

In this example, the client certificate is called client.cer.
This command will create a new file called client.ks
It will ask you what you want the password to be, remember what you used as the password.

Then when you run your web service client, use these parameters:
-Djavax.net.ssl.trustStore=C:\fullpast\client.ks
-Djavax.net.ssl.trustStorePassword=password

except use the password you created instead the word password.
 
Ola Daniel
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Dave

It is working now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!