CXF Conduit setting for SSL and non-SSL client

Hi, there: Long time no see again. Spent a few days on some thing strange using CXF. I finally found out that there is some buggy issue with CXF Client. When hitting at WS on HTTPS/SSL, only cxf.xml will be effective. In details, the conduit client and authorization has to be configured in cxf.xml to make them work.

<http:conduit name=”https://.*”&gt;
<http:authorization>
<sec:UserName>userid1</sec:UserName>
<sec:Password>userpass1</sec:Password>
<sec:AuthorizationType>Basic</sec:AuthorizationType>
</http:authorization>
<http:client AutoRedirect=”false” Connection=”Keep-Alive”
AllowChunking=”true” ReceiveTimeout=”3600000″ ConnectionTimeout=”3600000″ />
</http:conduit>

But for NON-SSL request,  you need to configure them in code:

HTTPConduit http = (HTTPConduit) cl.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setAllowChunking(true);
httpClientPolicy.setConnectionTimeout(TIMEOUT);
httpClientPolicy.setReceiveTimeout(TIMEOUT);
httpClientPolicy.setAsyncExecuteTimeout(TIMEOUT);
http.setClient(httpClientPolicy);

AuthorizationPolicy authorizationPolicy = new AuthorizationPolicy();
authorizationPolicy.setUserName(testUserID);
authorizationPolicy.setPassword(testUserPass);
authorizationPolicy.setAuthorizationType(“Basic”);
http.setAuthorization(authorizationPolicy);

I suspect this is a bug in CXF (at least version 2.74).   I haven’t fully tested it to make cxf.xml to work with NON-SSL. But I am sure there is this bug that for HTTPS, only cxf.xml file can work.

Cheers!

-TY

Advertisements