天天看点

5、使用JAX-WS注解开发WebService程序

1、基本常用注解

通过jaxws提供注解对wsdl接口内容进行规范

2、@WebService定义服务,在public class上边

targetNamespace:指定命名空间

name:portType的名称

portName:port的名称

serviceName:服务名称

endpointInterface:SEI接口地址,如果一个服务类实现了多个接口,只需要发布一个接口的方法,可通过此注解指定要发布服务的接口。

3、@WebMethod 定义方法,在公开方法上边

perationName:方法名

exclude:设置为true表示此方法不是webservice方法,反之则表示webservice方法

4、@WebResult-定义返回值,在方法返回值前边

name:返回结果值的名称

5、@WebParam 定义参数,在方法参数前面

name:指定参数的名称

继续阅读