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();
}
}
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();
}
}