请看下面的客户端代码:
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);
}
}
Axis2 客户端调用 设置超时时间,布布扣,bubuko.com
原文:http://www.cnblogs.com/dingmy/p/3712204.html