AXIS2 and JAX-WS how can I change the SSL handshaking?
-
19-09-2019 - |
Question
I need to customize the SSL handshaking when calling a JAX-WS API on top of Axis2.
I find no reference at all on how to do this. With Metro I can set a custom SSLSocketFactory, but that uses a non standard API.
How do I get access to the Axis engine so that I can reconfigure it before sending a soap request ?
Solution 3
I gave up on Axis2 and WebSphere SOAP. It took less time to just implement my own JAX-WS that support everything I need. Too bad.
OTHER TIPS
You probably have a stub class that extends org.apache.axis2.client.Stub
. You can set its transport properties:
YourStubClass stub = new YourStubClass();
stub.initStub(endpointUrl);
stub._getServiceClient().getOptions().setProperty(HTTPConstants.CACHED_HTTP_CLIENT, soapHttpClient);
Where endpointUrl
is a String containing the endpoint URL and soapHttpClient
is an instance of the Apaches's HTTP Client (org.apache.commons.httpclient.HttpClient
).
When you create your HttpClient object, you can customize your SSL handshaking.
You can set the default SSLSocketFactory for the HttpsURLConnection using the static method setDefaultSSLSocketFactory. This will then be the socket factory for al new instaces of HttpsURLConnection. We got this working in an SE application, I think it would work with Axis too.