从 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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 18:54:28  来源:igfitidea点击:

Generate WSDL from java class\source

javawsdl

提问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).

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

回答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。

回答by puug

Axis2is another alternative, specifically the java2wsdl command/plugin

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