Web services in IntelliJIDEA using the Web Services plugin

Guest Author
As I mentioned in my previous
, 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
. The author has agreed
to add support for GlassFish v2

The first step is to install the plugin. Select "File", "Settings ...", "Plugins",
"Available" tab, scroll to the bottom and select "WebServicesPlugin"
as shown
. 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

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
  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" as shown
  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" as shown
    . 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 used Tomcat
  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
    . 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
  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
  6. And finally you view the result as shown

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 for IDEA-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 services WSIT

Join the discussion

Comments ( 2 )
  • Arun Gupta's Blog Saturday, February 10, 2007
    [Trackback] As a follow up from a previous blog, the Web Services plugin in IntelliJIDEA now supports GlassFish v2. Here are the steps I followed to deploy the Web service on GlassFish: I updated the plugin version from "0.6 build 2"...
  • Arun Gupta's Blog Thursday, July 10, 2008
    [Trackback] IntelliJ IDEA 7.0.x include plugins that provide support for configuring GlassFish. This blog provides clear instructions on how to get started by developing and deploying a JSP, Servlet and Web services using GlassFish in IntelliJ. The instructions a...
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.