微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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()); } }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐