Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I generate WADL from RESTful Java code in IntelliJ IDEA?

I have a simple RESTful service in IntelliJ IDEA 12.1.3 Ultimate.

I've tested it. It works. Now I want to create a Java client for this service and need a WADL.

Per the instructions at http://wiki.jetbrains.net/intellij/RESTful_WebService , I right clicked my class and went to "Web Services -> RESTful Web Services" only to find the menuitem "Generate WADL from Java Code" disabled.

What have I done wrong?

Here's the code:

package com.mybiz;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

@Path("/greeting")
public class Greeter {
    @GET
    @Produces("text/plain")
    public String hello() {
        return "Hi!";
    }
}

Update

It seems that using TomEE as the application server disables this feature. I'm guessing that the application server is where the WADL is generated and I'm not using the application server that IntelliJ understands.

Am I right? If I switched application servers would it work? What application server should I use?

like image 400
Jason Avatar asked Nov 13 '22 04:11

Jason


1 Answers

You can try to generate your beans manually. There is a good example on how to do this here:

http://cxf.apache.org/docs/jaxrs-services-description.html

Read the part wadl2java command line tool.

If your client project is a maven project, you can also add the the maven plugin that you can find on the same page.

Hope this helps

like image 140
sashok_bg Avatar answered Nov 14 '22 22:11

sashok_bg