使用CXF和Maven将源代码注释导出到WSDL? [英] Export source code comments to the WSDL using CXF and maven?
问题描述
就像标题所述:是否可以将Web服务方法参数的javadoc注释导出到wsdl中?我们正在使用CXF和java2ws目标以及maven从源代码生成wsdl。
Like the title says: Is it possible to export my javadoc comments for web service method parameters into the wsdl? We're using CXF and the java2ws goal with maven to generate the wsdl from source code.
推荐答案
您可以使用 @WSDLDocumentationCollection
批注将多个 @WSDLDocumentation
批注附加到一个方法(具有不同的位置),但是您不能使用它来比将文档放在端口的单个操作上要深入得多,因为它不再是WSDL问题,而成为XSD问题。 XSD文档将由JAXB级别的注释处理,除了不存在这样的注释;生成的架构将不包含< xs:documentation>
元素。 (从架构开始时,文档注释可以作为Javadoc生成,但是相反的方向不会发生,因为Javadoc注释没有保留在Java类文件中。)
You can use the @WSDLDocumentationCollection
annotation to attach multiple @WSDLDocumentation
annotations to a single method (with different placements) but you can't use this to go much deeper than placing documentation on single operations of a port, because that's where it ceases to be a WSDL problem and becomes an XSD problem. XSD documentation would be handled by an annotation at the JAXB level, except that no such annotation exists; the schema generated won't contain <xs:documentation>
elements. (When starting from a schema, documentation comments can be generated as Javadoc, but the reverse direction doesn't happen as Javadoc comments aren't retained in Java class files.)
这篇关于使用CXF和Maven将源代码注释导出到WSDL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!