I am calling a external webservice but I have to use proxy settings and
authorization. How do i do  that using CXF? I am configuring that in java
using conduit but its not working. When I use the same set of credentials
using the raw HTTP client it works but not through CXF conduit. here is the
sample code I used. 
this is the HTTP way which works: 
CloseableHttpClient httpclient = null; 
                 HttpHost proxyHost = null; 
         HttpHost targetHost = new HttpHost(<hostname>,<port>); 
         RequestConfig config = null; 
                 if(wsUtil.getProxyRequired() != null) 
                 { 
                         credsProvider =
getCredentialObj(wsUtil.getProxyRequired()); 
                         proxyHost = new HttpHost(wsUtil.getProxyUrl(),
wsUtil.getProxyPort(),wsUtil.getProxyType()); 
                         config =
RequestConfig.custom().setProxy(proxyHost).build(); 
                         httpclient =
HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); 
                 } 

this is the cxf way which doesn't work: 

HTTPClientPolicy clientPolicy = conduit.getClient(); 
                clientPolicy.setProxyServer(wsUtil.getProxyUrl()); 
                clientPolicy.setProxyServerPort(wsUtil.getProxyPort()); 
                clientPolicy.setProxyServerType(ProxyServerType.HTTP); 

               
conduit.getProxyAuthorization().setUserName(wsUtil.getProxyId()); 
               
conduit.getProxyAuthorization().setPassword(wsUtil.getProxyPwd());



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Proxy-error-while-calling-Webservice-through-proxy-auth-tp5746482.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to