首先你需要把引入你的jar包,就是axis的lib目录下的那些东东。
然后编写程序:
package client;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
public class MyClient {
public static void main(String[] args) {
try {
String endpoint = "http://localhost:8088/axis/HelloWorld.jws";
Service service = new Service();
Call call = null;
call = (Call) service.createCall();
call.setOperationName(new QName(
"http://localhost:8088/axis/HelloWorld.jws", "sayHello"));
call.setTargetEndpointAddress(new java.net.URL(endpoint));
String ret = (String) call.invoke(new Object[] { "胡阳" });
System.out.println("return value is " + ret);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
运行一下:
- from the5fire.com
----EOF-----
微信公众号:Python程序员杂谈
微信公众号:Python程序员杂谈