java 有什么方法可以使用 JAX-WS 从 Javadoc 生成 WSDL 文档?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1746199/
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-10-29 17:48:55  来源:igfitidea点击:

Any way to generate WSDL documentation from Javadoc with JAX-WS?

javadocumentationwsdljax-wswsgen

提问by les2

I'm hoping that an extension of some kind is available that does this (although I suppose that my hope is foolishly optimistic).

我希望可以使用某种扩展来做到这一点(尽管我认为我的希望是愚蠢的乐观)。

   /**
     * <p>
     * Gets the {@link ResultObject} given the identifier. The following
     * fields are not available for some users and will contain a null value:
     * </p>
     * 
     * <ul>
     * <li>{@code resultObject.comment}</li>
     * <li>{@code resultObject.anotherObject.actionById}</li>
     * <li>{@code resultObject.anotherObject.actionByName}</li>
     * </ul>
     * 
     * <p>
     * The {@code daysInPurgatory} value will be {@code -1} when not
     * applicable
     * </p>
     * 
     * @param requestUser
     *            the user initiating the request
     * @param identifier
     *            the id of the ResultObject
     * @return the {@link ResultObject} or {@code null} if none exists
     * @throws SomeException
     *             if the {@code identifier} is {@code null}
     */
    @WebMethod
    @WebResult(name = "resultObject")
    public ResultObject getResultObjectById(
     @WebParam(name = "RequestUser", header = true, partName = "RequestUser") final String requestUser,
     @WebParam(name = "identifier") final Long identifier)
     throws SomeException;

Thanks, LES2

谢谢,LES2

采纳答案by sfussenegger

You may look at Enunciate. It's possible to use it's Maven pluginto generate static HTML files from Javadoc comments. This works for SOAP (i.e. JAX-WS) and REST (i.e. JAX-RS) endpoints.

你可以看看宣读。可以使用它的 Maven 插件从 Javadoc 注释生成静态 HTML 文件。这适用于 SOAP(即 JAX-WS)和 REST(即 JAX-RS)端点。

Interesting reads:

有趣的朗读:

Production Examples:

生产实例:

回答by Pascal Thivent

You're not the only one looking for a way to generate WSDL documentation (see the Generating WSDL documentation from Javadocthread) but, AFAIK, there is no standardJAX-WS way for doing this.

您并不是唯一一个在寻找生成 WSDL 文档的方法的人(请参阅从 Javadoc线程生成 WSDL 文档),但是,AFAIK,没有标准的JAX-WS 方法可以做到这一点。

Now, maybe have a look at JBoss proprietary annotation @Documentationmentioned in JBWS-1850that generates jaxws:bindingartifacts described in section 2.9 Javadoc Customizationwhen using Java->WSDL approach as well. It's not exactly what you asked for but it might give you some ideas.

现在,也许可以看看JBWS-1850@Documentation提到的JBoss 专有注释,在使用 Java->WSDL 方法时生成jaxws:binding2.9Javadoc 自定义中描述的工件。这不完全是你所要求的,但它可能会给你一些想法。

In any case, I guess that this would require providing your own WSDLGeneratorExtensionto extend wsgenand generate the desired WSDL.

无论如何,我想这需要您提供自己WSDLGeneratorExtension的扩展wsgen和生成所需的 WSDL。

回答by Dafka

In one project we published a lot of WSDLs. For every Web Service we have exposed a WS method "getDocumentationURL()". This method deliver back a link to the JavaDoc generated from the SEI. The JavaDoc was place on a accessible intranet server.

在一个项目中,我们发布了很多 WSDL。对于每个 Web 服务,我们都公开了一个 WS 方法“getDocumentationURL()”。此方法返回一个指向从 SEI 生成的 JavaDoc 的链接。JavaDoc 放置在可访问的 Intranet 服务器上。