编写客户端程序,编译并执行
方法一:
package com.demo.axis.test;
import com.demo.axis.client.HelloWorldServiceLocator;
import com.demo.axis.client.HelloWorld_PortType;
public class TestClient {
public static void main(String[] args) {
HelloWorld_PortType client;
HelloWorldServiceLocator service = new HelloWorldServiceLocator();
String destAddress = service.getHelloWorldAddress();// 服务地址
String returnStr = "";
try {
java.net.URL endpoint = new java.net.URL(destAddress);
client = service.getSayHello(endpoint);
returnStr = client.sayHello("加菲猫");// 调用服务端方法
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(returnStr);
}
}