客户端调用代码 Client.java package com.quickmap.common;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.soap.SOAPBinding;
public final class Client {
private static final QName SERVICE_NAME
= new QName("http://common.quickmap.com/", "HelloWorld");
private static final QName PORT_NAME
= new QName("http://common.quickmap.com/", "HelloWorldPort");
private Client() {
}
public static void main(String args[]) throws Exception {
Service service = Service.create(SERVICE_NAME);
// Endpoint Address
//String endpointAddress = "http://localhost:9000/helloWorld";
// If web service deployed on Tomcat (either standalone or embedded)
// as described in sample README, endpoint should be changed to:
String endpointAddress = "http://localhost:8080/nkydsj/services/hello_world";
// Add a port to the Service
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
HelloWorld hw = service.getPort(HelloWorld.class);
System.out.println(hw.sayHi(",webservice调用成功啦!!!"));
}
} 运行后