>java认证设置cxf的webservice客户端超时时长,在使用webservice的时候,我们有可能需要一个备份的webservice服务器.一旦主服务器down了,我们可以使用备份的服务器.那么这里就需要对客服端连接服务器的时间做一个修改.背景:在使用webservice的时候,我们有可能需要一个备份的webservice服务器.一旦主服务器down了,我们可以使用备份的服务器.那么这里就需要对客服端连接服务器的时间做一个修改.在spring+cxf的webservice环境下,客户端有两个时间属性是可配置的,分别是connectiontimeout和receivetimeout.connectiontimeout--webservice以tcp连接为基础,这个属性可以理解为tcp的握手时的时间设置,超过设置的时间长则认为是连接超时.以毫秒为单位,默认是30000毫秒,即30秒.receivetimeout --这个属性是发送webservice的请求后等待相应的时间,超过设置的时长就认为是相应超时.考试#大提示以毫秒为单位,默认是60000毫秒,即60秒.设置的例子:123 xmlns:xsi="http://www.w3.org/2001/xmlscha-instance"4 xmlns:jee="http://www.springframework.org/scha/jee"5 xmlns:jaxws="http://cxf.apache.org/jaxws"6 xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"7 xsi:schalocation="http://www.springframework.org/scha/beanshttp://www.springframework.org/scha/beans/spring-beans-2.0.xsd8 http://www.springframework.org/scha/jeehttp://www.springframework.org/scha/jee/spring-jee-2.0.xsd9 http://cxf.apache.org/jaxws http://cxf.apache.org/schas/jaxws.xsd10 http://cxf.apache.org/transports/http/configurationhttp://cxf.apache.org/schas/configuration/http-conf.xsd ">1112131415这里需要注重的有几个地方:1:需要指定http-conf名称空间xmlns:http-conf=http://cxf.apache.org/transports/http/configuration2:指定标准样式位置: http://cxf.apache.org/transports/http/configurationhttp://cxf.apache.org/schas/configuration/http-conf.xsd3:http-conf:conduit中的name属性,指定设置起效的服务,如例子中,只对服务名为{http://impl.service.product.sww.com/}projectservice的服务起效.使用下面的设置则会对所有服务起效>