I have WS clients inside the application server making web services calls out to other servers. I need to specify the SSLSocket factory to be used by the request (as I have custom keystores and trust stores).
The first obvious solution is to set the default SSLSocketFactory of the HttpsURLConnection:
{code}
// SSLSocketFactory factory = ...
HttpsURLConnection.setDefaultSSLSocketFactory(factory);
{code}
This works fine on both JBoss 5.1.0 and GlassFish 3.1.2 as long as all SSL connections in the VM can use the same truststore/keystore and keys.
However in my case I want to be able to connect to different servers using different keystores and having multiple concurrent requests. This means that setting the SSLSocketFactory globally for the VM is not an option.
Instead the JAX-WS RI offers an way of specifying the SSLSocketFactory per request:
{code}
import com.sun.xml.ws.developer.JAXWSProperties;
...
EjbcaWS ejbca = service.getEjbcaWSPort();
BindingProvider binding = (BindingProvider) ejbca;
Map<String, Object> requestContext = binding.getRequestContext();
requestContext.put(JAXWSProperties.SSL_SOCKET_FACTORY, factory);
{code}
This achieves exactly the functionality I need and works perfect on GlassFish, however the property is ignored by JBoss 5.1.0.GA-jdk6.
Is there a similar property that JBoss uses or how can I achive different SSL socket factories per request?