Friday, November 11, 2011

Enabling Proxy server for CXF Client

If you ever have the need to enable proxy server for a CXF based webservice client, this is the way to go about it:

Assuming a Spring based application, add this new namespace to the Spring configuration file:


Now, if all outbound requests are via a proxy server then make the following entry in your Spring configuration:

 <http-conf:conduit name="*.http-conduit">
  <http-conf:client ProxyServer="${proxy.server}" ProxyServerPort="${proxy.port}" />  

If you need to disable the proxy server, just provide an empty proxy.server parameter.

If you need to enable it only for specific WS requests, then the conduit name has to be modified to the specific services portType:
http-conf:conduit name="{}SoapPort.http-conduit"

More information here.

No comments:

Post a Comment