You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Zhao Sharon-CSC002 <Sh...@motorola.com> on 2004/02/26 21:02:27 UTC

How to make client using SSL

Hi ,
  I am using Axis created client stub. How do I make the client using TLS/SSL (under J2SE 1.4.2)? Do I need to change the client stub? Please provide me some guidline here.

Thanks,

Sharon Zhao
iDEN/WLAN, GTSS
Motorola Inc.

RE: How to make client using SSL

Posted by Greg Hess <gh...@wrappedapps.com>.
Sharon,

Just ask the locator class for a stub using the method that asks for a
URL arg, and that's it.

ServiceProviderServiceLocator loc = new ServiceProviderServiceLocator();
m_stub = (ServiceProviderSoapBindingStub) loc.getServiceProvider(new
URL("https://domain/services/ServiceProvider"));

I am impressed at how easy it was to use Basic-Auth and SSL to secure my
WebService. My code didn't change at all, just passed the https url and
had the stub setUsername and setPassword and bingo.

You will have to add the Server Cert in the java truststore in order to
complete the SSLHandshaking though. Just use keytool -import.

1) Get the server certificate (server.cer)

2) Create a security folder in your containers lib

3) Go to JAVA_HOME/jre/lib/security and copy cacerts to the
container/lib/security and rename server.truststore

4) Place server.cer into that container/lib/security/server.truststore

5) Use keytool to import the cert into truststore for eg:

keytool -import -v -trustcacerts -alias tomcat -file server.cer
-keystore server.truststore -storepass changeit

6) Tell the jvm about the new truststore for eg:

<system-property
javax.net.ssl.trustStore="c:\\resin\\lib\\security\\server.truststore"/>

7) Pass the https url to your locator and should work.

More info at:

http://www.j2ee-security.net/book/dnlds/Chapter11-WebService_Security.pd
f  

Should work :-).

Cheers,

Greg

> -----Original Message-----
> From: Zhao Sharon-CSC002 [mailto:Sharon.Zhao@motorola.com]
> Sent: Thursday, February 26, 2004 3:02 PM
> To: 'axis-user@ws.apache.org'
> Subject: How to make client using SSL
> 
> Hi ,
>   I am using Axis created client stub. How do I make the client using
> TLS/SSL (under J2SE 1.4.2)? Do I need to change the client stub?
Please
> provide me some guidline here.
> 
> Thanks,
> 
> Sharon Zhao
> iDEN/WLAN, GTSS
> Motorola Inc.