views:

523

answers:

3

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 ?

A: 

Axis2 is configured using axis.xml. Here is the section on http transport.

You may also want to look at the rampart module and how to configure it.

I hope that helps. There's not a lot of information out there on this topic.

Michael Sharek
And where would I put this axis.xml ? And how can I have one per invocation ? I need programmatic access to setting the parameters.
David Nouls
+1  A: 

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.

Alceu Costa
I will try this flag. After much searching I finally found a way to get the ServiceClient and I set a Protocol handler on the options... but somehow it is not used. Maybe the CACHED_HTTP_CLIENT could be a solution ? The problem I have is that this is Axis as available in WebSphere and they seem to have wired in their own transport classes . I'm negotiating with IBM to get a solution, but they don't seem to understand their own tools. They only allow me to set a keystore as a file, which is not fine grained enough for my case.
David Nouls
I'm testing this on tuesday!
David Nouls
Hope it works! We had to cutomize transport for Axis to enable basic HTTP authentication and I believe that it will probably work for your SSL customization also. BTW, you mentioned the keystore file, I don't know if that is what you want, but it is possible to add, programmatically a new SSL certificate to it...
Alceu Costa
No, it did not work. Too bad. On a normal Axis2 it works fine, but not on WebSphere's version.Adding SSL certificates to the SSLtrust is not something that I want to do. We only want one cert in the keystore when we connect. We do not want to accept a cert signed by another ca cert because those CA's are different banking institutes.Changes that that could happen is indeed small, but not small enough for paranoid banking people.
David Nouls
A: 

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.

David Nouls