客户端调用
需要axis的jar包
package db;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class TestWebService {
public static void main(String[] args) throws Exception {
String msg = "" ;
try{
String endpoint = "你设置的Service服务端地址";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
//设置远程方法
call.setOperationName("login");
//如果远程方法需要接受参数.则上面的写法为:(String)call.invoke(new Object[]{参数1,参数2,..});
//如果远程方法不需要接受参数,则写为:(String)call.invoke(new Object[]{});
}
catch(Exception ex) {
ex.printStackTrace();
}
}
}
需要axis的jar包
package db;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class TestWebService {
public static void main(String[] args) throws Exception {
String msg = "" ;
try{
String endpoint = "你设置的Service服务端地址";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
//设置远程方法
call.setOperationName("login");
//如果远程方法需要接受参数.则上面的写法为:(String)call.invoke(new Object[]{参数1,参数2,..});
//如果远程方法不需要接受参数,则写为:(String)call.invoke(new Object[]{});
}
catch(Exception ex) {
ex.printStackTrace();
}
}
}