• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do you create a webservice client using WSDL2Java which uses SSL?

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone. I'm trying to create a webservice client using wsdl2java and it must comunicate with the webservice via SSL. I have the keystores set up for this. How do I get WSDL2Java to generate https ready code using my keystores? Thanks, guys.


Prem
 
Ranch Hand
Posts: 548
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there is nothing like ready code.

1. Import the server certificats in ur client truststore,
2. run wsdl2java on https endpoint and generate the stubs
3. set below properties in ur client program

System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

Security.addProvider (new com.sun.net.ssl.internal.ssl.Provider());

System.setProperty("javax.net.ssl.trustStore", "<trust store location>");
System.setProperty("javax.net.ssl.trustStoreType", "jks | JCEKS");
System.setProperty("javax.net.ssl.trustStorePassword", "??");
System.setProperty("javax.net.ssl.keyStoreType", "jks");
System.setProperty("javax.net.ssl.keyStore", "<trust store location>");
System.setProperty("javax.net.ssl.keyStorePassword", "??");
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the keystore has more than one key, which one will be used for the communication with the server?
 
prem saggar
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with the question above. Which key is used in the keystore if there are multiple keys? Thanks for all the help. Prem
 
Ranch Hand
Posts: 1067
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You only want one key per keystore/truststore.
 
Peter Hu
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My application needs to connect with a couple of different web services servers at the same time. I have to use multiple certificates. How do my web services client knows which one to pick?
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi RR Kumaran and others,

If the client is not a standalone java client, but a servlet running on Websphere 5, is it still the same that I just set the properties you mentioned below in my servlet calling the web services?

All any one knows the steps to set this(client only) up in websphere? Since the JVM is in the container though.

Thanks in advance!!!

Originally posted by RR Kumaran:
there is nothing like ready code.

1. Import the server certificats in ur client truststore,
2. run wsdl2java on https endpoint and generate the stubs
3. set below properties in ur client program

System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");

Security.addProvider (new com.sun.net.ssl.internal.ssl.Provider());

System.setProperty("javax.net.ssl.trustStore", "<trust store location>");
System.setProperty("javax.net.ssl.trustStoreType", "jks | JCEKS");
System.setProperty("javax.net.ssl.trustStorePassword", "??");
System.setProperty("javax.net.ssl.keyStoreType", "jks");
System.setProperty("javax.net.ssl.keyStore", "<trust store location>");
System.setProperty("javax.net.ssl.keyStorePassword", "??");

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic