如何 使用注解方式形成wsdl
package cn.itcast.service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
@WebService(targetNamespace="http://www.itcast.cn", serviceName="MyService")
public class HelloService {
//不想让外界调用
@WebMethod(exclude=true)
public String sayHello(String name){
System.out.print("say hello called......");
return "hello"+name;
}
///为了更好说明参数信息
@WebMethod(operationName="hello")
@WebResult(name="ret")
public String sayHello(@WebParam(name="name")String name,@WebParam(name="age")int age){
System.out.print("say hello called.....int.");
return "hello"+name+age;
}
public static void main(String[]args){
Endpoint.publish("http://localhost:5084/hello", new HelloService());
}
}