簡體   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