プロジェクト

全般

プロフィール

Vote #70411

未完了

Restful Web service: generate WADL

Admin Redmine さんがほぼ4年前に追加. ほぼ4年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
REST API_32
対象バージョン:
-
開始日:
2011/07/26
期日:
進捗率:

0%

予定工数:
category_id:
32
version_id:
0
issue_org_id:
8900
author_id:
25114
assigned_to_id:
0
comments:
8
status_id:
1
tracker_id:
2
plus1:
3
affected_version:
closed_on:
affected_version_id:
ステータス-->[New]

説明

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

Some QA: http://bitworking.org/news/193/Do-we-need-WADL


journals

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

--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
+1

Would be very helpful to detect and test Redmine RESTful API.
--------------------------------------------------------------------------------
+1
--------------------------------------------------------------------------------
Redmine Java API supports Redmine 1.3.0
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------

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

Admin Redmine さんがほぼ4年前に更新

  • カテゴリREST API_32 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0