https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292011-08-04T20:37:44ZRedmineRedmine - Feature #8900: Restful Web service: generate WADLhttps://www.redmine.org/issues/8900?journal_id=312692011-08-04T20:37:44ZJean-Baptiste Barth
<ul></ul><p>Nicolay Punin wrote:</p>
<blockquote>
<p>It helps to generate Java Rest clients automaticaly.</p>
</blockquote>
<p>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 ?</p>
<p>Maintaining it in a plugin could be a viable option too...</p> Redmine - Feature #8900: Restful Web service: generate WADLhttps://www.redmine.org/issues/8900?journal_id=313402011-08-08T21:16:41ZNicolay Punin
<ul></ul><p>1. No manaualy. Wadl generator library helps you. For example, <a class="external" href="http://rubydoc.info/gems/wadl_generator/0.1.2/WADL/Generator">http://rubydoc.info/gems/wadl_generator/0.1.2/WADL/Generator</a><br />2. It will increase the attractiveness for java developers. <br />3. I do not want to use this(<a class="external" href="http://code.google.com/p/redmine-java-api">http://code.google.com/p/redmine-java-api</a>) library. </p>
<ul>
<li>It supports only 1.2.0. Not 1.3 </li>
<li>It is a bike :(</li>
</ul>
<p>4. I am work with redmine Rest API by means of Spring rest template (<a class="external" href="http://blog.springsource.com/2009/03/27/rest-in-spring-3-resttemplate/">http://blog.springsource.com/2009/03/27/rest-in-spring-3-resttemplate/</a>). <br /> At least 90% of my code can be automatically Generate by WADL parser. It is very convenient<br />5. This will be useful for the community. <br />6. This may be used in java IDE (Eclipse/RubyMine/Idea/Netbeans,etc.)</p>
<blockquote><blockquote>
<p>Maintaining it in a plugin could be a viable option too...</p>
</blockquote></blockquote>
<p>I writed already the plugin for me. It can show or modify project roles and status. <br />Maybe I'll write a WADL redmine plugin. If I will have a time :)</p>
<p>Something information: </p>
<ul>
<li>wadl generator library <a class="external" href="http://rubydoc.info/gems/wadl_generator/0.1.2/WADL/Generator">http://rubydoc.info/gems/wadl_generator/0.1.2/WADL/Generator</a></li>
<li>wadl online generator <a class="external" href="http://tomayac.de/rest-describe/latest/RestDescribe.html">http://tomayac.de/rest-describe/latest/RestDescribe.html</a></li>
<li>question in stackoverflow <a class="external" href="http://stackoverflow.com/questions/1100109/wadl-wsdl-2-0-for-restful-services-in-ruby-on-rails">http://stackoverflow.com/questions/1100109/wadl-wsdl-2-0-for-restful-services-in-ruby-on-rails</a></li>
</ul> Redmine - Feature #8900: Restful Web service: generate WADLhttps://www.redmine.org/issues/8900?journal_id=313642011-08-09T22:13:37ZTerence Mill
<ul></ul><p>+1</p> Redmine - Feature #8900: Restful Web service: generate WADLhttps://www.redmine.org/issues/8900?journal_id=317472011-08-25T09:14:53ZSiegfried Vogel
<ul></ul><p>+1</p>
<p>Would be very helpful to detect and test Redmine RESTful API.</p> Redmine - Feature #8900: Restful Web service: generate WADLhttps://www.redmine.org/issues/8900?journal_id=328782011-10-14T15:15:18Zlaurent sauvage
<ul></ul><p>+1</p> Redmine - Feature #8900: Restful Web service: generate WADLhttps://www.redmine.org/issues/8900?journal_id=351042012-01-03T17:07:58ZAlex Last
<ul></ul><p>Redmine Java API supports Redmine 1.3.0</p> Redmine - Feature #8900: Restful Web service: generate WADLhttps://www.redmine.org/issues/8900?journal_id=351052012-01-03T17:11:31ZAlex Last
<ul></ul><p>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.</p> Redmine - Feature #8900: Restful Web service: generate WADLhttps://www.redmine.org/issues/8900?journal_id=353272012-01-12T11:02:23ZNicolay Punin
<ul></ul><p>Redmine Java API is not suitable for my case, because in my redmine installation I have plugins enhancing default REST functionality.<br />I wrote my own Java client using Sping Rest Template( link: <a class="external" href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html">http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html</a>) and JAXB to write less code.</p>
<p>Here is the idea:<br />Describing entity, for example - a project<br /><code><br /> 9 @XmlRootElement<br /> 10 @XmlType( propOrder={ "name", "identifier", "description", "homepage", "status", "public", "roles", "customFields" , "createdOn", "updatedOn"} )<br /> 11 public class Project {<br /> 12 <br /> 13 final public static int STATUS_ACTIVE = 1;<br /> 14 final public static int STATUS_ARCHIVE = 9;<br /> 15 <br /> 16 private String name;<br /> 17 private String homepage;<br /> 18 private String identifier;<br /> 19 private String description;<br /> 20 private boolean is_public;<br /> 21 private int status;<br /> 22 private List<Role> roles;<br /> 23 private List<CustomField> customFields;<br /> 24 private String createdOn;<br /> 25 private String updatedOn;<br /> 26 /// etc....</code></p>
<p>In the same way describing entities Role and CustomField.<br />Projects list is described simply:<br /><code> 9 @XmlRootElement<br /> 10 @XmlSeeAlso({Project.class})<br /> 11 public class Projects extends ArrayList<Project> {<br /> 12 <br /> 13 @XmlElement(name = "project")<br /> 14 public List<Project> getProjects() {<br /> 15 return this;<br /> 16 }<br /> 17 }</code></p>
<p>Instead of standard Redmine API, in my case it is possible to manage project roles and project status (archive/active)</p>
<p>All other job is done by Spring Rest Template, for example this is how we can get projects list: <br /><code>Map<String, String> vars = new HashMap<String, String>();<br /> 69 vars.put("offset", "0");<br /> 70 vars.put("limit", "10");<br /> 71 Projects projects = restTemplate.getForObject("http://some.redminehost.net/projects.xml?offset={offset}&limit={limit}", Projects.class, vars);<br /> 72 return projects.getProjects();</code></p>
<p>Updating project: <br /><code>String identifier = project.getIdentifier();<br />restTemplate.put("http://some.redminehost.net/projects/{identifier}.xml", project, identifier);</code></p>
<p>And so on for every redmine entity. Of course, this code is placed in separate class and covered with junit tests.</p>
<p>It would be great to generate this boilerplate code automatically.</p>