webservice
服务端
package vedio.webservice; import javax.jws.WebMethod; import javax.jws.WebService; import javax.xml.ws.Endpoint; @WebService public class Server { @WebMethod public String sayHello(String s){ System.out.println("service get info :"+s); return "hello,"+s; } @WebMethod public boolean getXml(String xml){ return true; } public static void main(String[] args) { //create and publish an endPoint Server hello = new Server(); Endpoint endPoint = Endpoint.publish("http://localhost:8080/Server", hello); } }
客户端
package vedio.webservice; public class Client { public static void main(String[] args) { Server service = new Server(); System.out.println(service.sayHello("你好")); } }

浙公网安备 33010602011771号