Java Blog for Alex Wan

Let life be beautiful like summer flowers and death like autumn leaves.

统计

留言簿(10)

BlogJava

Blogs

DIV+CSS

JQuery相关

友情链接

常去的地方

数据供应

阅读排行榜

评论排行榜

[CXF]Spring下设置CXF的WebService客户端超时时长

背景:
在使用WebService的时候,我们可能需要一个备份的WebService服务器.一旦主服务器down了,我们可以使用备份的服务器.那么这里就需要对客服端连接服务器的时间做一个修改.

在Spring+CXF的WebService环境下,客户端有两个时间属性是可配置的,分别是ConnectionTimeout和ReceiveTimeout.
ConnectionTimeout--WebService以TCP连接为基础,这个属性可以理解为tcp的握手时的时间设置,超过设置的时间长则认为是连接超时.以毫秒为单位,默认是30000毫秒,即30秒.

ReceiveTimeout -- 这个属性是发送WebService的请求后等待响应的时间,超过设置的时长就认为是响应超时.以毫秒为单位,默认是60000毫秒,即60秒.


设置的例子:

 1<?xml version="1.0" encoding="UTF-8"?>
 2<beans xmlns="http://www.springframework.org/schema/beans"
 3    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4    xmlns:jee="http://www.springframework.org/schema/jee"
 5    xmlns:jaxws="http://cxf.apache.org/jaxws"
 6    xmlns:http-conf="http://cxf.apache.org/transports/http/configuration" 
 7    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
 8           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.0.xsd
 9           http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
10           http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd ">
11        <http-conf:conduit name="{http://impl.service.product.super.com/}ProjectService.http-conduit"> 
12        <http-conf:client ConnectionTimeout="10000" ReceiveTimeout="20000"/>
13    </http-conf:conduit> 
14</beans>
15

 

这里需要注意的有几个地方:
1:需要指定http-conf名称空间 xmlns:http-conf=http://cxf.apache.org/transports/http/configuration
2:指定模式位置: http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
3:http-conf:conduit中的name属性,指定设置生效的服务,如例子中,只对服务名为{http://impl.service.product.sww.com/}ProjectService的服务生效.
使用下面的设置则会对所有服务生效

<http-conf:conduit name="*.http-conduit">
      
</http-conf:conduit>


更详细的配置请参考CXF官方文档:

http://cwiki.apache.org/CXF20DOC/client-http-transport-including-ssl-support.html

 



Let life be beautiful like summer flowers and death like autumn leaves.

posted on 2008-09-04 16:45 Alexwan 阅读(5640) 评论(26)  编辑  收藏 所属分类: J2EE

评论

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2010-01-05 21:47 Emily32Av

A kind of good information about this good post. The good accomplished custom written essays and the ability to <a href=" http://www.supremeessays.com">buy essay</a> just about this topic is suggested by paper writing services.   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2010-08-16 23:07 credit loans

Every one remembers that life seems to be not cheap, however some people need cash for various issues and not every one gets big sums cash. Thus to receive fast home loans or short term loan would be a correct solution.   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2010-08-22 23:55 custom research paper

Actually, it's not hard to buy essay writing service when you are pressured by time to write custom paper. Hence, that's a common thing to search for custom company.   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2010-12-30 10:32 dress

I can't believe how much of this I just wasn't aware of. Thank you for bringing moreinformation to this topic for me. I'm truly grateful and really impressed  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-01-11 21:30 dissertation

Very oft to get the dotoral level you should purchase thesis summary about this good post and thesis.   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-07-06 17:00 buy an essay

What are essays writing services? These corporations help university students to cope with papers writing and it ought to be available to buy custom essay papers written by experts.   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-07-08 16:52 bookmark service

A lot of business owners say things like: "Whay should I utilize the automatic social bookmarking service?", or "Which way can it assist me? " The answer is easy! Bookmarking submissions options offered by experts can generate more sales at your internet site.   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-07-13 05:04 thesis writing service

Want to have high academic grades? Therefore, all you have to do is to complete the English thesis of premium quality or purchase thesis analysis at the dissertation writing service.   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-07-13 08:39 thesis service

The thesis ideas creating deal can be fascinating but time consuming. Therefore, when some people want to take a rest and perform their fantastic story referring to this topic, they should to find the professional thesis writing service, which would help people all the time.   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-07-15 10:47 research papers online

Lots of different people in the world are searching for specialized custom writing support. Thence, we can propose to buy college essay and be assured, it's a bright decision.   回复  更多评论   

# cpanel hosting 2011-12-10 01:59 mivpljaipur@gmail.com

,我们可以使用备份的服务器.那么这里就需要对客服端连接服务器的时间做  回复  更多评论   

# cpanel hosting 2011-12-10 02:00 cpanel hosting

指定设置生效的服务,如例子中,只对服务  回复  更多评论   

# Latest news 2011-12-12 16:00 Latest news

the world are searching for specialized custom writing support.   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-12-14 01:46 hostgator coupon

您出示您的文章,信息和能力,給未知的事實是所有的最令人驚訝的因素,我徹底留下深刻的印象。  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-12-15 15:57 claim online

A lot of business owners say things like:   回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-12-19 19:06 Free online dating

The thesis ideas creating deal can be fascinating but time consuming.  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2011-12-31 17:02 Exotic Car Rental Miami

TCP连接为基础,这个属性可以理解为tcp的握手时的时间设置,超过设置的时间长则认为是连接超时.以  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2012-01-06 20:18 Logo design

Not a big fan of the subject but a good read none the less.
  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2012-02-14 01:20 hostgator promo code

Web服務是一種可以在許多方面使用的工具集。  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2012-02-14 01:21 bluehost coupon 3.95

Web服務也可以用來實現一個架構,面向服務架構的概念。  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2012-02-14 01:22 best cpanel hosting

自動化工具,可以幫助創建一個Web服務。  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2012-05-12 17:57 Seo UK

性可以理解为tcp的握手时的时间设置,超过设置的时间长则认为是连接超时.以毫秒为单位,默认是3  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2012-05-16 11:27 website design india

This is such a Great resource that you are providing and you give it away for free. It gives in depth information. Thanks for this valuable information.


  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2012-05-28 17:31 Digital Marketing Agency

待响应的时间,超过设置的时长就认为是响应超时.以毫秒为单位,默认是60000毫秒,即60秒.  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2012-08-07 19:06 best casino

这个属性是发送WebService的请求后等待响应的时间,超过设置的时长就认为是响应超时.以毫秒为单位,默认是60000毫秒,即60秒.  回复  更多评论   

# re: [CXF]Spring下设置CXF的WebService客户端超时时长 2014-01-22 13:34 Web Design Bangalore

Thank you for this great blog! Really enjoying every little bit of it and I have you bookmarked to check out new stuff you post.  回复  更多评论   


只有注册用户登录后才能发表评论。


网站导航: