//必须要有服务端的接口
public interface HelloWorldInter {
public String get_message(String message);
public String get_baseinfo();
}
//访问服务端
public void get_client()
{
Service srvcModel = new ObjectServiceFactory().create(HelloWorldInter.class);
XFireProxyFactory factory =
new XFireProxyFactory(XFireFactory.newInstance().getXFire());
String URL ="http://127.0.0.1:8080/sjzhbwebservice/services/HelloWorld";
try {
HelloWorldInter hh = (HelloWorldInter)factory.create(srvcModel, URL);
System.out.println(hh.get_baseinfo());
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
WebService客户端访问服务端代码
猜你喜欢
转载自2691727110.iteye.com/blog/1752866
今日推荐
周排行