How to use the generated WADL Intellij code for RESTful WS client?

So I've installed IntelliJ and sucessfully generated my Endpoint  class that contains all the boilerplate code to access the JSON web  services described in my WADL, just after adding a missing  wadl-core-SNAPSHOT-1.0-SNAPSHOT.jar (the generated code wasn't compiling  and latest versions of wadl-core from 1.1 to 1.5 don't have certain  expected classes) and after switching the "intelliJ web service engine"  from the default glassfish to "restful web services".

Also, the latest intelliJ does not have the option to generate from a WADL, but this is another issue.

From intelliJ wiki page, (see  there's a very brief explanation about how to generate the classes, but it suddenly stops the explanation saying that

That’s all for now. Of course, this tutorial only covers the  essential topics you will need to build a Web Service application with  IntelliJ IDEA. There’s a lot more of things to explore and features that  can help you enhance your application: integration with Hibernate,  Spring, support for EJB, JSP, AJAX, integration with many popular  application servers, and a whole lot more. Check out for additional details

and the link, obviously, does not provide any example of how to use the generated classes :-)

so I have for example a RESTful method like this


and IntelliJ generated a class called target and another called search, so I can do something like

Search x = new Target.Search();

but I can't find anywhere how to pass the "name" attribute to it  neither how to get results. All I can see are some methods from these  objects, that I simply don't know how to deal with

public static void main(String[] args) throws JAXBException, MalformedURLException, IOException{
    Target t = new Target();
    Search x = new Target.Search();

    javax.activation.DataSource appJson = x.getAsApplicationJson();

    String type = "?";
    String domain = "?";
    String org = "?";
    String name = "?";
    String hostname = "?";
    String description = "?";
    javax.activation.DataSource appJson2 = x.getAsApplicationJson(type, domain, org, name, hostname, description);//?

    javax.activation.DataSource input = null; //?
    t.postAs(input); //?

I confess I was expecting a little bit more, like some code I could  just use :-). Or maybe I am not getting the point of this code  generation stuff.

So my question is: how do I work with the generated java code for a  RESTful client generated by IntelliJ from a WADL? Is there any tutorial,  any example somewhere? Is that the expected code? Should I, now, create  all the missing input parameters? How do I use this DataSource thing in  this context?

This is so worse than generating a client from a WSDL, where all the  methods and their signatures are clear and explicitly defined :-(

One simple example of how to make a simple search (using any intelliJ  generated code of course) and retrieve some results is enought for me,  then I can just find out myself.



Please sign in to leave a comment.