2

I have a requirement where i need to create a wizard/ plug-in in eclipse to generate the java client code for APIs' (REST). I have been searching for open source code that i can use. Only reference i could find was from fiware (http://catalogue.fiware.org/enablers/downloads-24). The plugin is not working, so i am not sure whether the code is good.

Are there any alternatives to this. I would like to take this and extend the code to support multiple API platforms and SOAP services as well.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
anil
  • 154
  • 1
  • 8
  • Not a direct answer so posting it as a comment, i strongly suggest using netflix/feign for making REST calls from java. Its makes code readable and its easy to use too. https://github.com/Netflix/feign – zengr Mar 17 '16 at 18:03

1 Answers1

1

In order to automatically generate a client for a RESTful service, you'd need some description of such service.

Currently, WADL is a format suitable to provides such information (similar to WSDL for SOAP services). Research that format, but there may be others.

There are tools already that are able to process WADL and generate a Java client for the described application, like wadl2java or , which is also discussed here: Restful Client from WADL . They also mention Fiware, which you may be able to use as a starting point for your own plugin.

Community
  • 1
  • 1
jjmontes
  • 24,679
  • 4
  • 39
  • 51
  • This is somehow against REST principles! RESTful application are based on the HTTP protocol and its verbs. A REST client only needs to understand the verbs of this protocol (and all the impatcs they have) and the data format returned by the service. All other information are gathered from the returned document (like available links and embedded entities). WADL is just a WSDL-like approch which contradicts the REST philosophy – Roman Vottner Mar 17 '16 at 18:37
  • I don't have an opinion on WADL but the OP shall possibly consider your comment and offer that approach in his REST client generator plugin too. – jjmontes Mar 18 '16 at 14:14