WebService发布服务例子

import javax.jws.WebMethod;
import javax.jws.WebService;
 
@WebService
public interface WebServiceI {
     
    @WebMethod
    String sayHello(String name);

}
import javax.jws.WebService;
 
@WebService
public class WebServiceImpl implements WebServiceI{
 
    @Override
    public String sayHello(String name) {
        // TODO Auto-generated method stub
        return "你好-"+name;
    }
 

     
}

发布

import javax.xml.ws.Endpoint;
 

 
public class WebServicePublish {
     
    public static void main(String[] args) {
        String address = "http://192.168.1.53:12345/UserService/getService";
        Endpoint.publish(address, new WebServiceImpl());
        System.out.println("webService发布成功");
    }
}

http://cxf.apache.org/download.html下载cfx项目解压,配置系统环境

maven web项目里添加cfx

 

 

 


 

 


 

怎么调用这些方法参考 https://www.cnblogs.com/tk55/p/11298435.html

 

posted on 2019-08-04 17:36  Honey_Badger  阅读(...)  评论(...编辑  收藏

导航

ゅ≈❤≈ゅ