5

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?

Jason
  • 11,709
  • 9
  • 66
  • 82
  • I just did it on one of my Restful services, but it is an `interface` with an implementation `class` (that IntelliJ appropriately found wired via Spring) and I return `Response` instead of arbitrary types. It appears that it does _not_ hit up the server, rather it starts a fresh server using my production folder, and then it does a local "remote" scan. – pickypg Jun 05 '13 at 23:35
  • Thanks pickypg. What application server are you using? – Jason Jun 06 '13 at 01:58
  • I'm using Glassfish, but ironically I am preparing to switch to TomEE. – pickypg Jun 06 '13 at 03:18
  • Does it help if you [download JAX WS](https://jax-ws.java.net/2.2.7/JAXWS2.2.7-20120813.zip), unpack it to some directory and [configure it like this](http://img195.imageshack.us/img195/8159/20130606112513.png)? – CrazyCoder Jun 06 '13 at 07:26
  • What JAX-RS implementation are you using? Using jersey application.wadl creates by itself! You should give it a try – jmoreira Jul 19 '13 at 02:44
  • Updating link: https://www.jetbrains.com/idea/help/restful-webservices.html – AlikElzin-kilaka Jan 13 '16 at 09:37

2 Answers2

1

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

sashok_bg
  • 2,436
  • 1
  • 22
  • 33
0

For JAX-RS there is IDEA support (e.g. Enabling REST support for an existing module) https://www.jetbrains.com/idea/help/preparing-for-rest-development.html#d1952527e119 Im looking solution for Spring MVC...

Grigory Kislin
  • 16,647
  • 10
  • 125
  • 197