This example requires Apache Axis:
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
public class test {
private String hostIp = null;
private int hostPort = 8090;
public test(String ip, int port) {
this.hostIp = ip;
this.hostPort = port;
}
public String execTest() {
try {
String endpoint = "http://" + this.hostIp + ":" + this.hostPort + "/test";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint));
call.setOperationName(new QName(endpoint, "test"));
return (String) call.invoke(new Object[]{});
} catch (Exception e) {
return null;
}
}
public static void main(String[] args) {
test soapCallTest = new test("192.168.0.5",8090);
String dateString = soapCallTest.execTest();
if (dateString != null) {
System.out.println("Date: " + dateString);
}
}
}