hengrg 发表于 2013-2-5 08:49:40

webserver

import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class SayHelloClient {
public static void main(String[] args){
//程序访问即时发布的服务
try{
   //创建访问点
   String endpoint = "http://localhost/webservice/SayHello.jws";
   //创建service
   Service service = new Service();
   Call call = null;
   //创建call
   call = (Call) service.createCall();
   //设置操作名
   call.setOperationName(new QName("http://localhost/webservice/SayHello.jws","getName"));
   //设置访问点
   call.setTargetEndpointAddress(new java.net.URL(endpoint));
   //调用服务,返回值
   String ret = (String) call.invoke(new Object[]{"zhangsan"});
   System.out.println("返回的信息是:" + ret);
}catch (Exception ex){
   ex.printStackTrace();
}
}
页: [1]
查看完整版本: webserver