Apache CXF客户端代理设置 [英] Apache CXF Client proxy settings

查看:992
本文介绍了Apache CXF客户端代理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用
的教程开发肥皂服务消费者 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();

有人能告诉我是否可以使用requestContext属性设置代理服务器设置以及如何设置代理服务器设置?我的代码在代理后面运行,我需要支出SOAP调用以使用代理服务器设置。

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.

推荐答案

代理设置通常设置通过使用httpconduit对象

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");

这篇关于Apache CXF客户端代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆