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; } }
发布html
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项目解压,配置系统环境java
maven web项目里添加cfxweb
怎么调用这些方法参考 http://www.javashuo.com/article/p-ymcktlrn-go.htmlapache