从 java class\source 生成 WSDL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1666714/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Generate WSDL from java class\source
提问by Oleksandr
I have a package with "logic" classes(like CheckAuthenticationDataLogic.java, GetVocabulariesLogic.java). And another class - ApiService.java is used to generate wsdl. ApiService.java is full of methods like this:
我有一个带有“逻辑”类的包(如 CheckAuthenticationDataLogic.java、GetVocabulariesLogic.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));
}
As you see it's just a proxy methods... So i want to avoid doing same work twice and generate WSDL right from logic classes without writing ApiService.java. Any tool or library for this purpose exists ?
正如你所看到的,它只是一个代理方法......所以我想避免做两次相同的工作,并直接从逻辑类生成 WSDL,而无需编写 ApiService.java。是否存在用于此目的的任何工具或库?
采纳答案by Pascal Thivent
The wsgentool generates JAX-WS portable artifacts used in JAX-WS web services. Note that you do not have to generate WSDL at the development time as JAXWS runtime will automatically generate a WSDL for you when you deploy your service.
该WSGEN工具生成JAX-WS与JAX-WS Web服务使用的便携式文物。请注意,您不必在开发时生成 WSDL,因为在您部署服务时,JAXWS 运行时会自动为您生成 WSDL。
You might want to check the JAX-WS RI documentationand especially the samples(pay a special attention to the fromjavasample).
回答by Frank Grimm
The Metro (http://metro.java.net/) web service stack provides a tool (wsgen) to generate WSDL from annotated Java.
Metro ( http://metro.java.net/) Web 服务堆栈提供了一个工具 (wsgen) 来从带注释的 Java 生成 WSDL。