我很难找到将 WADL 转换为 java 的命令行工具。无论我如何尝试谷歌、关注博客或 java.net 文档,都没有真正的下载链接。 (链接已损坏或已过时)。
哪个特定供应商、社区团体提供此工具?有免费下载链接吗?
生成的代码应该能够从 XML 响应重建 POJO,并在 Tomcat 7 中生存。
谢谢
回答:(仅在 2011 年 6 月之后有效):
- 将 Apache-CXF-2.4.1.zip(不是任何早期版本)提取
- 到根文件夹
- 将 Apache-CXF-2.4 解压到根文件夹。 1.src.zip
- 在 src 内搜索名为 distribution 的文件夹
- 提取 distribution 文件夹并将其合并(不覆盖根文件夹)
- 转到 bin 并找到 wadl2java.bat
- 从命令提示符运行 wadl2java.bat
- 继续没有任何细节
I have real difficulty finding commandline tool to convert WADL to java. No matter how much I try to google, follow blogs or java.net doc, there is no real download link. (links are broken or obsolete).
What particular vendor, community group is supplying this tool ? Does free download link exist ?
The generated code should be able to reconstruct POJOs from XML responses and survive inside Tomcat 7.
Thank you
Answer: (this works only after June 2011):
- Take Apache-CXF-2.4.1.zip (not any of the earlier versions)
- Extract it to root folder
- Take Apache-CXF-2.4.1.src.zip
- Search for folder named distribution inside src
- Extract ditribution folder and merge it with no overwrites to root folder
- goto bin and spot the wadl2java.bat
- run wadl2java.bat from command prompt
- continue with no brainer details
发布评论
评论(5)
Apache CXF 最近添加了对 WADL 优先开发 REST 服务。有关
wadl2java
工具的更多背景信息,请访问此 博客文章应该会有所帮助。Apache CXF recently added support for WADL-first development of REST services. For more background information on its
wadl2java
tool, this blog entry by one of the CXF committers should help.我在使用 CXF 2.5.4 wadl2java 工具时遇到了一些问题。它一直抱怨我的 WADL 文件中缺少“资源”元素,尽管它包含一个元素。
wadl.java.net 下载了对我有用的 wadl2java 。
I had some trouble using the CXF 2.5.4 wadl2java tool. It kept complaining of a missing "resources" element in my WADL file, even though it contained one.
wadl.java.net has a download of wadl2java that worked for me.
只是为了提供更新 CXF 版本 3.2.1 它对我有用。
步骤是
wadl2java
以获取用法wadl2java -p com.xyz wadl-file.xml
在当前目录中生成类。顺便说一句,我注意到它创建了一个名称中带有空格的类,并且还创建了名称以数字开头的类:)
Just to give an update with CXF version 3.2.1 it worked for me.
Steps are
wadl2java
to get the usagewadl2java -p com.x.y.z wadl-file.xml
to generate your classes in current directory.By the way I noticed that it created a class with a space in the name and also created classes with name starting with digits :)
从 Apache CXF 版本 2.7.11 开始,只需下载二进制 zip / tar.gz,将 CXF_HOME env-var 设置为 /path/to/apache-cxf-xyz 和 wadl2java位于
$CXF_HOME/bin
As of Apache CXF version 2.7.11 just download the binary zip / tar.gz, set
CXF_HOME
env-var to/path/to/apache-cxf-x.y.z
and wadl2java is available at$CXF_HOME/bin
要从 WADL 生成客户端存根,请使用工具 wadl2java。
从这里下载 wadl 工具:-
http://search.maven.org/remotecontent?filepath=org/jvnet/ws/wadl/wadl-dist/1.1.5/wadl-dist-1.1.5-bin.zip。
要生成客户端 java 存根(POJO),请使用以下命令:
\wadl2java -o .\src -p com.test.client WADL_FILE_LOCATION
如果您使用的是 Maven 项目,那么您可以使用 wadl2java maven 插件来完成这项工作。
For generating client side stubs from WADL, use a tool wadl2java.
Download wadl tool from here:-
http://search.maven.org/remotecontent?filepath=org/jvnet/ws/wadl/wadl-dist/1.1.5/wadl-dist-1.1.5-bin.zip.
For genearting client side java stubs(POJOs), use this command:
\wadl2java -o .\src -p com.test.client WADL_FILE_LOCATION
If you are using maven project then you can use wadl2java maven plugin for this work.