java webservice超时设置_java 设置WebService超时

//1,在CXF生成的stub的客户端,方式如下(CXF2.1.1):

SimpleServiceService srv = new SimpleServiceService();

SimpleService servicePort = srv.getSimpleServicePort();

//timeout setting

Client cl = ClientProxy.getClient(servicePort);

HTTPConduit http = (HTTPConduit) cl.getConduit();

HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();

httpClientPolicy.setConnectionTimeout(10000);

httpClientPolicy.setReceiveTimeout(1000);

http.setClient(httpClientPolicy);

servicePort.concatenate("111", "2222");

//其中SimpleServiceService是自动生成的stub类.

//2,在Xfire生成的stub的客户端,方式如下(Xfire1.26):

SimpleServiceServiceClient serviceClient= new SimpleServiceServiceClient();

SimpleService  servicePort = serviceClient.getSimpleServicePort();

HttpClientParams params = new HttpClientParams();

params.setParameter

你可能感兴趣的:(java,webservice超时设置)