You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Merritt, Norris" <no...@hp.com> on 2007/08/06 20:36:48 UTC

How to configure Axis2 so commons-http client uses custom SSL socket factory like the contributed AuthSSLProtocolSocketFactory?

Hi, I need to make Axis2 use a custom SSL socket factory so I can do SSL
client authentication. Commons-http supports the notion of custom SSL
socket factories, and there is a contributed one called
AuthSSLProtocolSocketFactory which looks like it does what I want. My
question is how to configure Axis2 to use this SSL socket factory
instead of the default one that it uses now.  I assume this can be done
without modifying Axis2 source code? Any pointers / help greatly
appreciated....


Re: How to configure Axis2 so commons-http client uses custom SSL socket factory like the contributed AuthSSLProtocolSocketFactory?

Posted by Paul Fremantle <pz...@gmail.com>.
Norris

If you set the property:
        HttpClient httpClient = // configure your HTTP client

Options.setProperty(HTTPConstants.CACHED_HTTP_CLIENT,httpClient);

Then Axis2 will use your HTTP client instead of creating one for you.

Paul

On 8/6/07, Merritt, Norris <no...@hp.com> wrote:
>
>
>
>
> Hi, I need to make Axis2 use a custom SSL socket factory so I can do SSL
> client authentication. Commons-http supports the notion of custom SSL socket
> factories, and there is a contributed one called
> AuthSSLProtocolSocketFactory which looks like it does what I want. My
> question is how to configure Axis2 to use this SSL socket factory instead of
> the default one that it uses now.  I assume this can be done without
> modifying Axis2 source code? Any pointers / help greatly appreciated….


-- 
Paul Fremantle
Co-Founder and VP of Technical Sales, WSO2
OASIS WS-RX TC Co-chair

blog: http://pzf.fremantle.org
paul@wso2.com

"Oxygenating the Web Service Platform", www.wso2.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: How to configure Axis2 so commons-http client uses custom SSL socket factory like the contributed AuthSSLProtocolSocketFactory?

Posted by "Ford, Jennifer M." <JE...@SOUTHERNCO.COM>.
I did exactly what you're describing recently, but I basically took the
envelope from the generated code and submitted it myself using the
commons-http lib.
 
Protocol authhttps = new Protocol("https", new
AuthSSLProtocolSocketFactory(

new URL("file:" + getKeyFileName()), getPassword(), 

new URL("file:" + getTrustFileName()), getPassword()), 443);

HttpClient client = new HttpClient();

client.getHostConfiguration().setHost(getURL(), 443, authhttps);

ORBWSStub requestObject = new ORBWSStub(); 

String env = requestObject.getEnvelope(myObj);

PostMethod httpget = new PostMethod(getPage());

httpget.addRequestHeader("SOAPAction", "\"TheAction\"");

httpget.addRequestHeader("Content-Type", "text/xml; charset=utf-8");

httpget.setRequestBody(env);  //this method is deprecated, but still
works.

int success = client.executeMethod(httpget);

I also had to modify the AuthSSLProtocolSocketFactory to use an already
generated store in pkcs12 format, but that was a relatively minor
change.
 
Thanks,
Jennifer Ford

________________________________

From: Merritt, Norris [mailto:norris.merritt@hp.com] 
Sent: Monday, August 06, 2007 1:37 PM
To: axis-user@ws.apache.org
Subject: How to configure Axis2 so commons-http client uses custom SSL
socket factory like the contributed AuthSSLProtocolSocketFactory?



Hi, I need to make Axis2 use a custom SSL socket factory so I can do SSL
client authentication. Commons-http supports the notion of custom SSL
socket factories, and there is a contributed one called
AuthSSLProtocolSocketFactory which looks like it does what I want. My
question is how to configure Axis2 to use this SSL socket factory
instead of the default one that it uses now.  I assume this can be done
without modifying Axis2 source code? Any pointers / help greatly
appreciated....