19

Is there any way generating automatically a jax-rs client with HttpUrlConnection or third party soloutions like jersey, apache, restlet etc. out of an wadl? Wouldnt it be an advantage to have a framework/application for this?

Robin Wieruch
  • 14,900
  • 10
  • 82
  • 107

4 Answers4

13

There is a rudimentary client-side code generator from WADL available with Apache CXF JAX-RS implementation http://cxf.apache.org/docs/jaxrs-services-description.html

It generates some boilerplate code, but it is nothing close to client generators for SOAP/WSDL web services.

Rob Kielty
  • 7,958
  • 8
  • 39
  • 51
Piotr Kochański
  • 21,862
  • 7
  • 70
  • 77
  • 1
    Okay. And is there any way that frameworks like jersey, resteasy, restlet can do so? – Robin Wieruch Apr 10 '12 at 10:05
  • 1
    I haven't seen anything like that. REST Easy provides "Client framework", Jersey provides "Client API", so writing client is less painful, but still has to be done from scratch. – Piotr Kochański Apr 10 '12 at 13:24
7

I use the wadl2java wadl-maven-plugin provided from the wadl site. It uses the Jersey client to do most of the work. Its far from perfect, but I've been using it with some success. It sure beats maintaining my own clients.

Aaron Roller
  • 1,074
  • 1
  • 14
  • 19
0

If you have available for your Rest service a WADL endpoint (i.e. you have created a REST project with Jersey) or WADL file, then you can try REST client generator plugin for Eclipse provides by FI-WARE project at link http://www.fi-ware.eu/tools/updates/.

In order to download it you must open Eclipse (we tested it on Eclipse indigo) and go in 'Help -> Install New Software...' and click the Add button; in the new pop-up set the name (any name you think it's useful to remeber the new plugin) and the URL I provided (http://www.fi-ware.eu/tools/updates/).

You will find four plugins, but in your case you can select only the FI-WARE REST client generator Plugin.

Here https://forge.fi-ware.eu/frs/download.php/167/REST_Client_Generator_User_Manual_0.0.1.pdf you'll find a user guide too. I hope this is useful

cheers Pasquale

pasquy73
  • 563
  • 3
  • 13
0

JDeveloper provides an option to create a Jersey client based on a provided WADL URL. It generates the skeletal code required to invoke the operations and you just need to invoke this code.

Paddy
  • 84
  • 4