eclipse 这几天怎么 wadl2java?

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

How to wadl2java these days?

javaeclipseweb-servicesrestwadl

提问by

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

我很难找到将 WADL 转换为 java 的命令行工具。无论我如何尝试 google、关注博客或 java.net 文档,都没有真正的下载链接。(链接已损坏或已过时)。

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

生成的代码应该能够从 XML 响应中重建 POJO 并在 Tomcat 7 中存活。谢谢

Answer: (this works only after June 2011):

答:(这仅在 2011 年 6 月之后有效):

  • 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
  • 使用 Apache-CXF-2.4.1.zip(不是任何早期版本)
  • 解压到根目录
  • 以 Apache-CXF-2.4.1.src.zip 为例
  • 在 src 中搜索名为 distribution 的文件夹
  • 提取分发文件夹并将其合并,不会覆盖根文件夹
  • 转到 bin 并找到 wadl2java.bat
  • 从命令提示符运行 wadl2java.bat
  • 继续没有脑子的细节

采纳答案by Brian Kelly

Apache CXFrecently added support for WADL-first developmentof REST services. For more background information on its wadl2javatool, this blog entryby one of the CXF committers should help.

Apache CXF最近添加了对WADL 优先开发REST 服务的支持。有关其wadl2java工具的更多背景信息,一位 CXF 提交者的这篇博客条目应该会有所帮助。

回答by gnuf

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.

我在使用 CXF 2.5.4 wadl2java 工具时遇到了一些问题。它一直抱怨我的 WADL 文件中缺少“资源”元素,即使它包含一个。

wadl.java.nethas a download of wadl2java that worked for me.

wadl.java.net下载了对我有用的 wadl2java。

回答by gerrytan

As of Apache CXF version 2.7.11 just download the binary zip / tar.gz, set CXF_HOMEenv-var to /path/to/apache-cxf-x.y.zand wadl2java is available at $CXF_HOME/bin

从 Apache CXF 版本 2.7.11 开始,只需下载二进制 zip / tar.gz,将CXF_HOMEenv-var设置为/path/to/apache-cxf-x.y.zwadl2java 可在$CXF_HOME/bin

回答by Mubashar

Just to give an update with CXF version 3.2.1it worked for me.

只是为了更新CXF 3.2.1 版,它对我有用

Steps are

步骤是

  1. Download anywhere
  2. Unzip
  3. Go to /bin
  4. Run wadl2javato get the usage
  5. Run wadl2java -p com.x.y.z wadl-file.xmlto generate your classes in current directory.
  1. 随处下载
  2. 解压
  3. 转到 /bin
  4. 运行wadl2java获取用法
  5. 运行wadl2java -p com.x.y.z wadl-file.xml以在当前目录中生成您的类。

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 :)

顺便说一下,我注意到它创建了一个名称中带有空格的类,并且还创建了名称以数字开头的类:)

回答by R.Ranjan

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.

要从 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

For genearting client side java stubs(POJOs), use this command: \wadl2java -o .\src -p com.test.client WADL_FILE_LOCATION

要生成客户端 java 存根(POJO),请使用以下命令:\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.

如果您使用的是 maven 项目,那么您可以使用 wadl2java maven 插件来完成这项工作。