webservice的常用注解

来源:互联网 发布:ccs软件百度云 编辑:程序博客网 时间:2024/06/06 02:41

webservice的常用注解

定义说明书的显示方法
1.@WebService(serviceName="PojoService", portName="PojoPort", name="PojoPortType", targetNamespace="http//:Pojo")
  serviceName 对应 <service name="PojoService">
  portName 对应 <service>下的 <port name="PojoPort">          
      name 对应 <portType name="PojoPortType">

     targetNamespace 对应 targetNamespace="http//:Pojo"

定义schemaLocation的显示
2.@WebMethod(operationName="queryPojo",exclude=true)
       operationName 接口的方法名
       exclude 用于阻止将某一继承方法公开为web服务,默认为false

3.@WebResult(name="returnWord") 接口的返回值

4.@WebParam(name="cityName")接口的参数

 

以下面代码为例

复制代码
@WebService(serviceName="PojoService",            portName="PojoPort",            name="PojoPortType",            targetNamespace="http//:Pojo"        )public class Impl implements WeatherInterface {    @WebMethod(operationName="queryPojo",exclude=true)    @Override    public @WebResult(name="result")List<Pojo> queryWeather(@WebParam(name="cityName")String cityName) {        
复制代码

wsdl对应的显示如下:

输入下图地址:

对应的的显示如下:

祝: 大家生活愉快,工作顺利
0 0