WADL Generation Tool

匿名 (未验证) 提交于 2019-12-03 01:46:01

问题:

Is there a tool which takes a Java File what describes a REST service as a parameter and generates a wadl file out of that.

回答1:

I had the same problem: was using RESTeasy and wanted to find a way to generate the WADL automatically.

Did some research and came to the solution below.

1. Add this to your pom.xml:

com.sun.jersey.contribsmaven-wadl-plugin1.17generategenerate${javadoc-phase}${project.build.outputDirectory}/application.wadl             truehttp://example.com:8080/restcom.example.rs.resource             com.sun.jersey.server.wadl.generators.WadlGeneratorApplicationDoc                     applicationDocsFile${basedir}/src/main/doc/application-doc.xmlcom.sun.jersey.server.wadl.generators.WadlGeneratorGrammarsSupport                     grammarsFile${basedir}/src/main/doc/application-grammars.xml

Pay attention to the buildUri and packagesResourceConfig elements. You have to change them to reflect your project's configuration. You may also want to change the plugin's version (I used 1.17).

2. Create a /doc folder and add some files.

Create the src/main/doc/ folder and create the two files below.

File: application-doc.xml

Content:

This is added to the start of the generated application.wadl

File: application-grammars.xml

Content:

3. Run the maven command.

Go to the project folder and run the following command:

$ mvn compile com.sun.jersey.contribs:maven-wadl-plugin:generate

The files \target\classes\application.wadl (the WADL itself) and \target\classes\xsd0.xsd (the schema of the resources - it's used by the application.wadl) should be generated.

Edit and use them as you wish.

PS.: Bear in mind that this is a very simple use of the maven-wadl-plugin. It can do a lot more. To know it better, please refer to the zip file mentioned in the other answer (by Pavel Bucek).



回答2:

Yes, please see gerenate-wadl [1] sample from Jersey samples (look for maven-wadl-plugin).

[1] http://search.maven.org/remotecontent?filepath=com/sun/jersey/samples/generate-wadl/1.12/generate-wadl-1.12-project.zip



转载请标明出处:WADL Generation Tool
文章来源: WADL Generation Tool
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!