【webservice】Axis2 客户端调用 设置超时时间
来源:互联网 发布:网站推广优化 编辑:程序博客网 时间:2024/05/23 01:14
转载自 http://www.cnblogs.com/dingmy/p/3712204.html
Axis2 客户端调用 设置超时时间
我用的是axis2-1.6.2版本。请看下面的客户端代码:
import org.apache.axis2.client.Options;
import com.ctis.ta.service.impl.OpenAccountForUnitServiceStub;
import com.ctis.ta.service.impl.OpenAccountForUnitServiceStub.OpenAndCheck;
import com.ctis.ta.service.impl.OpenAccountForUnitServiceStub.OpenAndCheckResponse;
public class Main {
public static void main(String[] args) throws Exception {
//OpenAccountForUnitServiceStub 是Axis2工具自动生成的类
OpenAccountForUnitServiceStub stub = new OpenAccountForUnitServiceStub();
OpenAndCheck openAndCheck = new OpenAndCheck();//openAndCheck 是服务端的方法
openAndCheck.setAddress("");//设置服务端方法OpenAndCheck()的参数值
Options options = stub._getServiceClient().getOptions();
options.setTimeOutInMilliSeconds(3);//设置超时(单位是毫秒)
stub._getServiceClient().setOptions(options);
OpenAndCheckResponse response = stub.openAndCheck(openAndCheck);//开始调用服务端的方法openAndCheck
String[] ret = response.get_return();//服务端返回一个数组
System.out.println(ret.length);
}
}
如果上面设置不生效,有可能是你的版本旧了。还有一种方法可以试试:
options.setProperty(HTTPConstants.SO_TIMEOUT, 300000);
axis2底层调用的是httpclient,它默认的尝试连接时间是60s,建立连接后,等待接收数据的时间也是60s。上面的写法是把等待接收数据时间延长。
- 【webservice】Axis2 客户端调用 设置超时时间
- Axis2 客户端调用 设置超时时间
- Axis2 客户端调用 设置超时时间
- Axis2 客户端调用 设置超时时间
- 客户端设置WebService调用超时时间
- 调用webservice 设置超时时间
- 调用webservice 设置超时时间
- CXF WebService 客户端设置超时时间
- webService 客户端调用 axis2
- WebService客户端Axis2调用
- xFire调用wsdl webservice超时时间设置
- Myeclipse调用webservice超时时间设置
- CXF-WebService设置超时时间
- axis2 webServerce 调用的超时设置
- 用AXIS2发布WebService和客户端调用
- Axis2 WebService 客户端访问超时,尝试连接3次
- 多次使用axis2调用webservice后,报连接超时错误
- 多次使用axis2调用webservice后,报连接超时错误
- c# vs2010 连接access数据库
- android Rxjava+Retrofit
- 时钟频率对程序效率影响测试(Platform: ARM ZYNQ 7000 ZP20 Board)
- PHP2.4+mysql5.7安装后的一个问题
- GNU C - 一个别致的HelloWorld程序 引申到: __attribute__((constructor)|(destructor)(PRIORITY))
- 【webservice】Axis2 客户端调用 设置超时时间
- SQL总结(快速参考)
- Nginx的下载、安装、启动|重启|关闭-虚拟机下操作
- 重写onKeyDown方法,监控返回键、菜单键和Home键
- Android 6预置APK的权限授予
- java反射技术
- FFmpeg视频转码技巧之-crf参数(H.264篇)
- lambada使用需求
- sql server如何查询指定行?