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對應的顯示如下:

輸入下圖地址:

對應的的顯示如下:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM