You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Idar Borlaug <id...@gmail.com> on 2010/06/04 14:25:28 UTC

Http proxy

Hi

I was wondering why my jax-ws client doesn't have proxy set
automatically when i have specified http.proxyHost, http.proxyPort,
proxySet, http.nonProxyHosts as vm parameters?

I tried printing the proxy settings with this code:
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setServiceClass(IssuerInvoiceServiceV10.class);
factory.setAddress(url);
this.service = (IssuerInvoiceServiceV10) factory.create();
Client client = ClientProxy.getClient(service);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = http.getClient();
System.out.println(httpClientPolicy.getProxyServer());

but nothing is set.

What is the best way to set proxy settings for jax-ws cxf client? Hope
someone can help me with this.

-- 
Idar

Re: Http proxy

Posted by Daniel Kulp <dk...@apache.org>.
See the instructions at:
http://cxf.apache.org/docs/client-http-transport-including-ssl-support.html

That said, defaulting in the VM properties if config isn't avail might not be 
a bad idea.   If you want to pursue it and set a patch (I don't have a proxy 
server so not really something I could test), you would probably need to add 
some code to the finalizeConfig method in HTTPConduit.  Basically, if the 
fields are not set in the ClientPolicy, set them with values from the system 
properties.

Dan


On Friday 04 June 2010 8:25:28 am Idar Borlaug wrote:
> Hi
> 
> I was wondering why my jax-ws client doesn't have proxy set
> automatically when i have specified http.proxyHost, http.proxyPort,
> proxySet, http.nonProxyHosts as vm parameters?
> 
> I tried printing the proxy settings with this code:
> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
> factory.setServiceClass(IssuerInvoiceServiceV10.class);
> factory.setAddress(url);
> this.service = (IssuerInvoiceServiceV10) factory.create();
> Client client = ClientProxy.getClient(service);
> HTTPConduit http = (HTTPConduit) client.getConduit();
> HTTPClientPolicy httpClientPolicy = http.getClient();
> System.out.println(httpClientPolicy.getProxyServer());
> 
> but nothing is set.
> 
> What is the best way to set proxy settings for jax-ws cxf client? Hope
> someone can help me with this.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog