2010-03-25 45 views
0

我有一組不同的接口的,我需要給他們通過Web服務訪問。動態WebService的實施

我已經實現如下所示在.NET這個任務:在IL動態生成的接口的實現,標有註釋的WebMethod方法,並在*的.asmx處理程序調用生成的存根。

更需要能夠改變方法簽名(如改變某些參數的類型或添加新的參數),即並不總是明確地實現接口,並把它作爲一個裝飾圖案。

實施例:

interface ISomeService { 
    void simpleMetod (String arg1); 
    void customMetod (CusomType arg1, Integer arg2); 
} 

// Need to dynamically generate such class 
@WebService 
class SomeWebService { 
    private ISomeService someService = new SomeServiceImpl(); 

    @WebMethod 
    public void simpleMethod (String arg1) { 
    someService.simpleMethod (arg1); 
    } 

    @WebMethod 
    public void customMethod (String arg1, Integer arg2) { 
    someService.customMethod (CusomType.fromString (arg1), arg2); 
    } 
} 

接口如ISomeService不少。並手動編寫這樣的代碼,我不想要。

我最近與Java工作,什麼樣的技術/應該使用的庫來解決這樣的任務。

謝謝。

回答

1

您可以使用Axis2創建可部署歸檔的Java應用服務類(不包括註釋)和服務描述符。