Thanks, Greg. That's really helpful.

Sharon

-----Original Message-----
From: Greg Hess [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 26, 2004 2:34 PM
To: [EMAIL PROTECTED]
Subject: RE: How to make client using SSL


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:[EMAIL PROTECTED]
> Sent: Thursday, February 26, 2004 3:02 PM
> To: '[EMAIL PROTECTED]'
> 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.

Reply via email to