Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache CXF Client proxy settings

I am trying to Develop a Consumer for Soap Service using the tutorial at http://cxf.apache.org/docs/developing-a-consumer.html

In the section ,"Setting Connection Properties with Contexts" I am looking at the code below

// Set request context property.
java.util.Map<String, Object> requestContext =
  ((javax.xml.ws.BindingProvider)port).getRequestContext();
requestContext.put(ContextPropertyName, PropertyValue);

// Invoke an operation.
port.SomeOperation();

Can someone tell me if I can set the proxy server settings using the requestContext properties and how ?. My code is running behind a proxy and I need the outgoings SOAP calls to use proxy server settings.

like image 975
avenirit12 Avatar asked Dec 08 '22 02:12

avenirit12


1 Answers

Proxy setting are usually set by using httpconduit object

HelloService hello = new HelloService();
HelloPortType helloPort = cliente.getHelloPort();
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(helloPort);
HTTPConduit http = (HTTPConduit) client.getConduit();
http.getClient().setProxyServer("proxy");
http.getClient().setProxyServerPort(8080);
http.getProxyAuthorization().setUserName("user proxy");
http.getProxyAuthorization().setPassword("password proxy");
like image 87
Aurelien Ecoto Avatar answered Dec 10 '22 16:12

Aurelien Ecoto