java cxf 入口统一_解决java - Apache CXF Client proxy settings

在使用Apache CXF开发SOAP服务消费者时,如果代码运行在代理服务器后面,可以通过设置HTTPConduit来配置代理服务器参数。示例代码展示了如何设置代理服务器地址、端口、用户名和密码。
摘要由CSDN通过智能技术生成

好文收藏:使用 Apache Maven 和 CXF 构建 RESTful web services http://www.ibm.com/developerworks/cn/opensource/os-restfulwebservices/index.html

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 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.

java

apache

web-services

soap

cxf

asked Jul 21 '15 at 21:36

avenirit12 48 2 9

|

1 Answers

1

解决方法

Proxy setting are usually set by using httpconduit object首先从http://www.apache.org的网站上下载apache-2.2.0的源代码。apache-2.2.0的版本做了些改动大家需要注意一下。首先apr和apr-util需要单独的安装,还有配置文

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

answered Jul 21 '15 at 22:35

Aurelien Ecoto 86 4      Did that , while running a simple unit test to ping the service I don't get any errors but the test is stuck and keeps printing these on the console –

avenirit12 Jul 22 '15 at 14:06      HTTPConduit:1740-No Trust Decider for Conduit '{

cxf.apache.org}TransportURIResolver.http-conduit'.An afirmative Trust Decision is assumed. HTTPConduit:914-Conduit '{

cxf.apache.org}TransportURIResolver.http-conduit' has been (re)configured for plain http. HTTPConduit:378-NoTrust Decider configured for Conduit '{

cxf.apache.org}TransportURIResolver.http-conduit' HTTPConduit:391-NoAuth Supplier configured for Conduit '{

cxf.apache.org}TransportURIResolver.http-conduit' has been configured for plain http. –

avenirit12 Jul 22 '15 at 14:11 1   I think the problem is occurring because the SOAP calls are finally calling a service on https and not http –

avenirit12 Jul 22 '15 at 14:19

|

转自:http://www.celinio.net/techblog/p=571 The WSDL2java command generates JAX-WS compliant Java code for the services that are defined in the WSDL

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值