从java class \ source生成WSDL

我有一个包含“逻辑”类的包(如CheckAuthenticationDataLogic.java,GetVocabularyiesLogic.java)。 另一个类–ApiService.java用于生成wsdl。 ApiService.java有很多像这样的方法:

/** * Check authentication data. * @param contractNumber - number of contract. * @param msisdn - msisdn. * @param superPassword - super password. * @return result of authentication. */ @WebMethod @WebResult(name = "result") public CheckAuthenticationDataResult checkAuthenticationData(@WebParam(name = "contractNumber") final String contractNumber, @WebParam(name = "msisdn") final String msisdn, @WebParam(name = "superPassword") final String superPassword) { return runLogic(new CheckAuthenticationDataLogic(contractNumber, msisdn, superPassword)); } 

正如你所看到的那样,它只是一个代理方法……所以我想避免两次做同样的工作,直接从逻辑类生成WSDL而不编写ApiService.java。 是否存在用于此目的的任何工具或库?

wsgen工具生成JAX-WS Web服务中使用的JAX-WS可移植工件。 请注意,您不必在开发时生成WSDL,因为JAXWS运行时将在您部署服务时自动为您生成WSDL。

您可能想要检查JAX-WS RI 文档 ,尤其是示例 (特别注意fromjava示例)。

Axis2是另一种选择,特别是java2wsdl命令/插件

Metro( http://metro.java.net/ )Web服务堆栈提供了一个工具(wsgen),用于从带注释的Java生成WSDL。