Posts Tagged tomcat

SSL and Web Service

SOAP doesn’t deal with whether the connection is SSL or not. This is a HTTP issue,so there is nothing to do in web service implementation to secure the connection.
If a secure connection is needed to establish then there are thing to do. Assume that the web container is Tomcat server then in TOMCAT_HOME/conf/server.xml the connection attibute has to be uptaded to ensure that Tomcat server accepts ssl connection requests.
After that, the certificate has to be loaded to the client, to achieve this, keytool command is used
keytool -import -trustcacerts -alias FOO -file “FOO_PATH\foo.cer” -storetype JKS -keystore “FOO_PATH\foo.keystore”
Secondly the code below has to be added to just before getting connetion to the server.


System.setProperty("javax.net.ssl.keyStore", "FOO_PATH/foo.keystore");
System.setProperty("javax.net.ssl.keyStorePassword","changeit");
System.setProperty("javax.net.ssl.keyStoreType","JKS");
System.setProperty("javax.net.ssl.trustStore", "FOO_PATH/foo.keystore");
System.setProperty("javax.net.ssl.trustStorePassword", "changeit");
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

Leave a Comment