package com.seejoke.uitl;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
/**
* webservice 第一节:如何使用webservice
*
* @web www.seejoke.com
* @author j@seejoke.com
* @date 2014-7-28 下午05:12:21
* @package com.seejoke.uitl
*/
public class TestClient {
public static String url = "http://127.0.0.1/axis/services/service.jws";
private static Service service = new Service();
private static Call call;
public static void main(String[] args) throws Exception {
serviceJoke("seejoke.com");
}
public static void serviceJoke(String token) throws Exception {
call = (Call) service.createCall();
// 设置service所在URL
call.setTargetEndpointAddress(new java.net.URL(url));
// 指定服务提供的方法名字
call.setOperationName("jokeService");
// 参数 token(一些列的参数根据实际编写)
Boolean ret = (Boolean) call.invoke(new Object[] { token });
// 执行结果true 成功 false 失败
System.out.println(ret);
}
}