日期:2014-05-18 浏览次数:52595 次
String serviceURL = "http://localhost:8080/A/services/IDataService";
Service serviceModel = new ObjectServiceFactory().create(
IDataService.class, null,
"http://localhost:8080/A/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();
}
Service serviceModel = new ObjectServiceFactory().create(
IDataService.class);