应用场景:
电子称 上传数据到电子称监控软件上,监控软件(该监控软件不能直接访问域名,奇怪!)调用 PC1上的webservice,PC1上的webservice在再访问后台服务提供的webservice
在电子称连续快速上传3次数据后会提示连接超时。
? ? ? ??Properties pro = new Properties();
pro.load(getClass().getResourceAsStream("/util.properties"));
String url = new String(pro.getProperty("web_url").getBytes("ISO8859-1"),"UTF-8");
System.out.println(url);
RPCServiceClient serviceClient = new RPCServiceClient();
Options options = serviceClient.getOptions();
EndpointReference targetEPR = new EndpointReference(url);
options.setTo(targetEPR);
options.setManageSession(true);
options.setProperty("REUSE_HTTP_CLIENT",Boolean.TRUE);
options.setAction("upLoad");
QName opName = new QName("http://impl.webService.com","upLoad");
Object args[] = {
xmlData //上传的数据
};
Class classes[] = {
java/lang/String
};
results = serviceClient.invokeBlocking(opName,args,classes);
serviceClient.cleanupTransport();
? ? ? ? ? ? 红色标记的代码可以解决描述的问题