1.创建webservice服务端
package com.rdz.test;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
@WebService(
name="HelloService", //服务实现类的名称
serviceName="HelloServiceFactory", //服务实现者
portName="HelloServiceInstance", //服务类型的名称
targetNamespace="com.rdz.test" //发布webservice服务的命名空间
)
public class HelloService {
@WebMethod(exclude=true) // exclude=true,则不发布该方法
public String sayHell(){
return "hello";
}
@WebMethod(operationName="showUserInfo") //发布出去的方法的名字
public String show(String name, int age){
return "姓名:"+name+" 年龄:"+age;
}
public static void main(String[] args) {
String address="http://127.0.0.1:1234/hello";
Endpoint.publish(address, new HelloService()); // 创建一个服务端点
System.out.println("发布