Feature #8900
closedRestful Web service: generate WADL
Added by Nicolay Punin over 13 years ago. Updated about 2 months ago.
0%
Description
Redmine does not generate WADL for his Web Service
(http://en.wikipedia.org/wiki/Web_Application_Description_Language)
It helps to generate Java Rest clients automaticaly.
specification: http://java.net/projects/wadl/sources/svn/content/trunk/www/wadl20090202.pdf
Updated by Jean-Baptiste Barth over 13 years ago
Nicolay Punin wrote:
It helps to generate Java Rest clients automaticaly.
And it will probably be a bunch of work to maintain it ... manually, no ? Have you tried to generated such an XML description of the Redmine current API, and can you give us some points to convince us to introduce it ?
Maintaining it in a plugin could be a viable option too...
Updated by Nicolay Punin over 13 years ago
1. No manaualy. Wadl generator library helps you. For example, http://rubydoc.info/gems/wadl_generator/0.1.2/WADL/Generator
2. It will increase the attractiveness for java developers.
3. I do not want to use this(http://code.google.com/p/redmine-java-api) library.
- It supports only 1.2.0. Not 1.3
- It is a bike :(
4. I am work with redmine Rest API by means of Spring rest template (http://blog.springsource.com/2009/03/27/rest-in-spring-3-resttemplate/).
At least 90% of my code can be automatically Generate by WADL parser. It is very convenient
5. This will be useful for the community.
6. This may be used in java IDE (Eclipse/RubyMine/Idea/Netbeans,etc.)
Maintaining it in a plugin could be a viable option too...
I writed already the plugin for me. It can show or modify project roles and status.
Maybe I'll write a WADL redmine plugin. If I will have a time :)
Something information:
- wadl generator library http://rubydoc.info/gems/wadl_generator/0.1.2/WADL/Generator
- wadl online generator http://tomayac.de/rest-describe/latest/RestDescribe.html
- question in stackoverflow http://stackoverflow.com/questions/1100109/wadl-wsdl-2-0-for-restful-services-in-ruby-on-rails
Updated by Siegfried Vogel about 13 years ago
+1
Would be very helpful to detect and test Redmine RESTful API.
Updated by Alex Last almost 13 years ago
Redmine Java API supports Redmine 1.3.0
Updated by Alex Last almost 13 years ago
Would be just great to generate the client code using some definition file. Until then, you're welcome to use (and improve!) the custom-made Redmine Java API.
Updated by Nicolay Punin almost 13 years ago
Redmine Java API is not suitable for my case, because in my redmine installation I have plugins enhancing default REST functionality.
I wrote my own Java client using Sping Rest Template( link: http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html) and JAXB to write less code.
Here is the idea:
Describing entity, for example - a project
9 @XmlRootElement
10 @XmlType( propOrder={ "name", "identifier", "description", "homepage", "status", "public", "roles", "customFields" , "createdOn", "updatedOn"} )
11 public class Project {
12
13 final public static int STATUS_ACTIVE = 1;
14 final public static int STATUS_ARCHIVE = 9;
15
16 private String name;
17 private String homepage;
18 private String identifier;
19 private String description;
20 private boolean is_public;
21 private int status;
22 private List<Role> roles;
23 private List<CustomField> customFields;
24 private String createdOn;
25 private String updatedOn;
26 /// etc....
In the same way describing entities Role and CustomField.
Projects list is described simply: 9 @XmlRootElement
10 @XmlSeeAlso({Project.class})
11 public class Projects extends ArrayList<Project> {
12
13 @XmlElement(name = "project")
14 public List<Project> getProjects() {
15 return this;
16 }
17 }
Instead of standard Redmine API, in my case it is possible to manage project roles and project status (archive/active)
All other job is done by Spring Rest Template, for example this is how we can get projects list: Map<String, String> vars = new HashMap<String, String>();
69 vars.put("offset", "0");
70 vars.put("limit", "10");
71 Projects projects = restTemplate.getForObject("http://some.redminehost.net/projects.xml?offset={offset}&limit={limit}", Projects.class, vars);
72 return projects.getProjects();
Updating project: String identifier = project.getIdentifier();
restTemplate.put("http://some.redminehost.net/projects/{identifier}.xml", project, identifier);
And so on for every redmine entity. Of course, this code is placed in separate class and covered with junit tests.
It would be great to generate this boilerplate code automatically.
Updated by Holger Just about 2 months ago
- Status changed from New to Closed
- Resolution set to Wont fix
The WADL standard seems to be mostly obsolete.
Also, maintaining such a description would be quite some undertaking given Redmine's API flexibility (which you can think of as either a positive or a negative). However, your use-case of even changing the generated description with plugins (and thus describing the changed fields and semantics) would introduce a whole lot of additional API interface and would effectively require a full rewrite in the way we currently generate API responses and accept data in controllers and models.
Thus, given the immense work required for that and the very limited number of possible consumers, I don't believe that this is not a worthwhile endeavor.