Title: SSL

I've found this example for Apache SOAP (SSL):

System.setProperty("javax.net.ssl.trustStore","C:\\YourDirectory\\client.keystore");
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

This is not thread safe. I'd like to load key store and give it to library, like in this Apache HttpClient example:

HttpClient httpclient = new HttpClient();
GetMethod httpget = new GetMethod("https://www.verisign.com/");

{
  KeyStore ksTrustStore = KeyStore.getInstance("JKS");
  FileInputStream fis = new FileInputStream("C:/jdk1.5.0_01/jre/lib/security/cacerts.jks");
  ksTrustStore.load(fis, "changeit".toCharArray());
  fis.close();

  Protocol myhttps = new Protocol("https",
                     new ManualSSLProtocolSocketFactory(ksTrustStore,
                                                        null,
                                                        ""),
                     443);
  Protocol.registerProtocol("https", myhttps);
  httpclient.getHostConfiguration().setHost("https://www.verisign.com/", 443, myhttps);
}

httpclient.executeMethod(httpget);

Is it possible with Apache SOAP lib, or I have to switch to Axis or ...?

Thank you very much.

Reply via email to