I'm trying to use a CXF generated client to connect to a web service. The problem however is that in order to connect to the service I need to connect through a (HTTP) proxy.
I found plenty of documentation on how to configure a proxy when using Spring, or how to programmatically setup a http proxy for a service port, but I cannot find any hints on how to programmatically configure a HTTP proxy to be used when creating the service from the WSDL URL. Using Spring is not an option (I'm am building a small component that runs in a huge framework in which the authors do not want to include Spring). So I need to solve it programmatically, but all documentation I have found presents a bootstrap problem, best explained using example: http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html#ClientHTTPTransport%28includingSSLsupport%29-HowtoconfiguretheHTTPConduitfortheSOAPClient%3F : SoapService service = new SoapService(wsdlURL); MyPort port = service.getMyPort(); Client client = ClientProxy.getClient(port); HTTPConduit http = (HTTPConduit) client.getConduit(); HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy(); httpClientPolicy.setProxyServer("1.2.3.4"); httpClientPolicy.setProxyServerPort(8088); httpClientPolicy.setProxyServerType(ProxyServerType.HTTP); http.setClient(httpClientPolicy); This example clearly explains how to set a proxy once you have a port for the service, but as one can see, the initial service object is created from a WDSL URL, but how to configure CXF to also use a HTTP Proxy when connecting to that initial WSDL URL? I have also tried to use the standard mechanisms from Java to configure a JVM global proxy servers (using -Dhttp.proxyHost, -Dhttp.proxyPort and related system properties), but this has proven to not be reliable, hence the effort to explicitly configure the proxy from code. (Standalone app/client works fine using (just) these system properties, but when embedded in the target framework (some of) these properties seem to be ignored: No HTTPS proxy will be used if no HTTP proxy is set, no matter what (HTTP/HTTPS) proxy ports are configured, for HTTPS it always tries to connect to port 443, no matter what proxy port has been configured) Any help/hints on this is appreciated :-) Thanks in advance! --Alex Buisman
