How to wadl2java these days?

纵然是瞬间 提交于 2019-11-30 08:34:04

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.

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.

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

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

Steps are

  1. Download anywhere
  2. Unzip
  3. Go to /bin
  4. Run wadl2java to get the usage
  5. Run wadl2java -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 :)

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.

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