Nirmish,
Yes, you are missing a key factor. The httpCommonsClient that is used
to invoke the service will depend on a trusted keystore if you are using
internal CAs. To make this work, you will want to set the
javax.net.ssl.trustStore and javax.net.ssl.trustStorePassword. Below is
an example of a small subroutine that will check the endPoint string,
determine if it begins with "https" and if it does, will look up the
"trustedServer.keystore" and "trustedServer.keypass" values from a
properties file then if the system can find the keystore file, it will
set the trustStore and trustStorePassword properties.
if(endPoint.indexOf("https")==0) {
String[] trustedServerArray={
"trustedServer.keystore","trustedServer.keypass" };
List trustedServerKeys=Arrays.asList(trustedServerArray);
Properties
trustedServerProps=pm.getProperties("gwsync",trustedServerKeys);
String
keyStoreFile=(String)trustedServerProps.get("trustedServer.keystore");
File keystore=new File(keyStoreFile);
String
keystorePass=(String)trustedServerProps.get("trustedServer.keypass");
if(keystore.exists()) {
System.setProperty("javax.net.ssl.trustStore",keystore.getPath());
System.setProperty("javax.net.ssl.trustStorePassword",keystorePass);
}
}
________________________________
From: Nirmish Dholakia [mailto:[email protected]]
Sent: Friday, June 18, 2010 7:50 PM
To: [email protected]
Subject: SSL communication problem with axis webservice client
Hi Group,
I need to use custom secure socket factory while communicating through
axis client to use self signed certificate . But even if I set custom
factory using System
.setProperty("org.apache.axis.components.net.SocketFactory","myfactory")
, default (i.e.JSSESocketFactory) only getting called.
I also tried using AxisProperties.setProperty() but no luck, I am
missing anything?
Can anybody help?