As I mentioned in my previous post, here are the steps to develop/deploy/invoke a Web service using the Web Services plugin in IntelliJ IDEA. Thanks to AdvancedTools, author of the plugin, for helping me through this process.


The Web service plugin bundles Axis 1.4 and supports JWSDP 2.0 ( contains JAX-WS 2.0 EA1 which is now final in Java 6), Axis 2, and XFire through pluggability. If you are interested in deploying on GlassFish using IDEA, then read this. The author has agreed to add support for GlassFish v2 though.

The first step is to install the plugin. Select "File", "Settings ...", "Plugins", "Available" tab, scroll to the bottom and select "WebServicesPlugin" as shown here. I clicked "Ok" after selecting the plugin and the dialog box disappeared without installing it. The arrow on the top-left corner has a tooltip of "Update Plugin" but did not convey the message. When I right-clicked on the plugin, I got "Download and Install" which made complete sense. And then I realized the arrow on top-left serves the same purpose as well. So I installed the plugin and restarted the IDE for plugin to take effect. I had to manually restart the IDE even though the plugin said that the IDE will restart automatically.

Once the plugin is successfully installed, at least following changes are noticed in the IDE:

  1. A "WebServices" tab is displayed in the bottom left corner of the IDE
  2. A new "Tools", "Web Services" menu is added
  3. A new "Window", "Tool Windows", "WebServices" menu item is added.
  4. A new "WebServices" icon is added to "Project Settings" (Ctrl+Alt+S default shortcut).

Of the supported toolkits, the closest to GlassFish is JWSDP and so I downloaded and installed JWSDP 2.0.

After JWSDP 2.0 installation, I configured the Web services plugin for JWSDP 2.0 location by selecting "File", "Settings", "WebServices" as shown here. Now, on to real business of creating a Web service. Here are the steps I used:

  1. Create a new Web module (wonder why 12 clicks are required for a default project).
  2. Add a new POJO as:
    package hello;

    public class Hello {
      public String sayHello(String name) {
        return "Hello " + name;

    It is required to have a non-default package ("hello" in this case).
  3. Select "Tools", "WebServices", "Enable Web Service Support" asshown here.
  4. Add @javax.jws.WebService annotation and so the class looks like
    package hello;

    public class Hello {
      public String sayHello(String name) {
        return "Hello " + name;
  5. Compile the class (default shortcut Ctrl+Shift+F9).
  6. Select "Tools", "WebServices", "Expose Class as Web Service" asshown here. The menu says "expose" and the window says "deploy" which I find confusing.
  7. It is recommended to "File", "Synchronize" before this step so that IntelliJ recognizes any newly generated files.
  8. Add a local Tomcat configuration using "Run", "Edit Configurations" (see GlassFish configuration instructions for more details). I usedTomcat 5.5.20.
  9. This runs the Tomcat server and displays "http://localhost:8080" and tries to display the resource "/" and shows 404. Instead type "http://localhost:8080/services/Hello" in the browser and the deployed Web service is shown correctly.

So far we have been able to deploy a JAX-WS based Web service and now we will invoke it.

  1. Create a new Web module (with all default settings). In "Deployment Descriptors" tab, uncheck "Include standard JavaEE runtime support". A warning message is displayed when you click on Next, select "Ok" and move on.
  2. Select "Tools", "WebServices", "Generate Java Code From Wsdl". Specify the package name as shown here. This generates the client-side artifacts. After clicking on "Ok" button, the dialog box just disappears without any information. But then I realized wsimport progress bar came and disappeared. Synchronize (default shortcut Ctrl+Alt+Y) the IDEand and then the artifacts are all generated in the client directory. A message box indicating what happened would be helpful.
  3. Expand "src", "client" and add a new class "HelloClient" to invoke the endpoint as shown below:

    public class HelloClient {
      public static void main(String[] args) {
        System.out.println(new HelloService().getHelloPort().sayHello("Duke"));
  4. Build the project (default shortcut Ctrl+F9).
  5. Select HelloClient, right-click and select "Run "HelloClient.main()"" (default short cut Ctrl+Shift+F10) as shown here.
  6. And finally you view the result as shown here.

As you can see by the traffic on the forum, this was all not intuitive :) The plugin author has promised to make the plugin more easy to use by providing wizards. But I'd expect Web service creation to be a first-class functionality in an IDE and so I recommend to vote forIDEA-13000. Look on the left bar for casting your vote.

Alternatively, you can use NetBeans 5.5.1 and GlassFish that gives you native and first class support for building/deploying/invoking interoperable Web services.

Technorati: NetBeans IntelliJ Eclipse GlassFish Web service WSIT