webservice6
如何 使用注解方式形成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()); } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |