ObjectServiceFactory o=new ObjectServiceFactory();
Service ss=o.create(Isayhello.class);
XFireProxyFactory xf=new  XFireProxyFactory(XFireFactory.newInstance().getXFire());
String url="http://localhost:8080/ss/services/sayhello";
try{
Isayhello a=(Isayhello)xf.create(ss, url);
System.out.println(a.example("ssss"));
}catch(Exception ex){
System.out.println(ex.getMessage());
}
//询问前面几行代码的意思,
还有另外几种webservice

解决方案 »

  1.   

    前面几行在创建代理.!webService除了Xfire,还有axis, JDK1.6之后也带有ws
      

  2.   

    ObjectServiceFactory o=new ObjectServiceFactory();
    Service ss=o.create(Isayhello.class);
    XFireProxyFactory xf=new XFireProxyFactory(XFireFactory.newInstance().getXFire());
    String url="http://localhost:8080/ss/services/sayhello";
    try{
    Isayhello a=(Isayhello)xf.create(ss, url);
    System.out.println(a.example("ssss"));
    }catch(Exception ex){
    System.out.println(ex.getMessage());
    }
    这一段是XFire的代码.!
    Axis生成客户端是另一种方式
    1.6的环境, 如果你配置好环境变量.
    可以cmd-> wsimport -s src -p pkg wsdl
    这样去生成客户端