日期:2014-05-20 浏览次数:20644 次
String serviceURL = "http://localhost:8080/Collect/services/IDataService"; Service serviceModel = new ObjectServiceFactory().create( IDataService.class, null, "http://localhost:8080/Collect/services/IDataService", null); XFireProxyFactory serviceFactory = new XFireProxyFactory(); try { IDataService service = (IDataService) serviceFactory.create( serviceModel, serviceURL); // 忽略http连接的超时时间,0为不设置超时时间,》=1为超时毫秒数 Client client = Client.getInstance(service); client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT, "0"); String hello = service.sayHello("admin"); System.out.println("服务器对[张山疯] 的回答是:" + hello); } catch (MalformedURLException e) { e.printStackTrace(); } }