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("你好"));
        
    }
}

 

posted @ 2017-06-07 09:56  javadongx  阅读(94)  评论(0)    收藏  举报

javadong@qq.com