繁体   English   中英

Apache CXF客户端代理设置

[英]Apache CXF Client proxy settings

我正在尝试使用http://cxf.apache.org/docs/developing-a-consumer.html上的教程开发肥皂服务消费者

在“使用上下文设置连接属性”一节中,我正在查看下面的代码

// 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调用来使用代理服务器设置。

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM