一次项目组中需要控制超时时间,前期习惯用CXF实现,熟悉的才是最好的。所以这次依然想用CXF实现。
实现的方式代码如下:
static{
String fvpWebserviceUrl = PropertyUtil.getConfig("fvpWebserviceUrl");
JaxWsProxyFactoryBean cxfFty = new JaxWsProxyFactoryBean();
cxfFty.setServiceClass(IWaybillQueryExtService.class);
if(StringUtils.isNotEmpty(fvpWebserviceUrl)){
cxfFty.setAddress(fvpWebserviceUrl);
service = (IWaybillQueryExtService) cxfFty.create();
setTimeoutTime(service);
}else{
logger.info("interface url"+fvpWebserviceUrl);
}
}
/**
* 设置web service 连接超时和读取超时
* @param service
*/
private static void setTimeoutTime(Object service){
Client proxy = ClientProxy.getClient(service);
HTTPConduit conduit = (HTTPConduit) proxy.getConduit();
H