Miles to go …

February 10, 2007

GlassFish v2 supported in IntelliJ Web Services Plugin

Filed under: webservices — arungupta @ 10:30 am

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:

  1. I updated the plugin version from "0.6 build 2" to "0.7 build 1" as shown here.
  2. Using Project Settings (default shortcut Ctrl+Alt+S), configure GlassFish in the Web Services plugin as shown here.
  3. Following steps 1, 2, and 3 from the previous blog, I created a POJO and enabled Web service support as shown here. There is no need to add any GlassFish specific deployment descriptor. However make sure web.xml is using version 2.5 as shown here.
  4. Following Steps 4, 5, and 6 from the previous blog, I added the @javax.jws.WebService annotation and exposed the class as Web service as shown here. The menu item changed from "Expose Class as Web Service" to "Deploy Class as Web Service". I find this confusing since at this stage the service endpoint is not getting deployed. Instead, under the covers required artifacts are generated. There is an explicit deploy step later and it’s confusing to mix that here. I think it should be renamed back to "Expose Class as Web Service".
  5. To configure and run the GlassFish instance and deploy the newly created module, follow the instructions as shown in Step 7 here.
  6. Once the GlassFish server has started, the endpoint is hosted at http://localhost:8080/hello/services/Hello.

Now, we need to invoke the Web service using the following steps:

  1. Add a new "Java Module" to the project by selecting "File", "New Module".
  2. Select the newly created module in the "Project" window. In "Tools" menu, select "WebServices", "Generate Java Code From Wsdl" as shown here. This generates the client-side artifacts and can be seen by expanding "src" node in "helloclient" module.
  3. Add a new class "HelloClient" in the "client" subnode of "src" as shown below:

    public class HelloClient {
      public static void main(String[] args) {
        System.out.println(new HelloService().getHelloPort().sayHello("Duke"));
      }
    }

  4. Build the module by selecting "helloclient" node, right-click, selecting "Make module "helloclient"".
  5. Add add activation.jar as a module library as shown here.
  6. Right-click HelloClient, select "Run "HelloClient.main()"" (default shortcut Ctrl+Shift+F10).
  7. The output window shows the result as shown here.

Thanks to AdvancedTools for adding GlassFish v2 support to the Web Services plugin.

Technorati: NetBeans IntelliJ Eclipse GlassFish Web service WSIT

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Related posts:
  1. Web services in IntelliJIDEA using the Web Services plugin
  2. Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse – Part 2
  3. Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse – Part 3
  4. Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse – Part 1
  5. Getting Started with GlassFish in IntelliJ IDEA

1 Comment »

  1. [Trackback] Interested in first-class support for GlassFish in IntelliJ IDEA ? Vote here. Since this is still a wish for IntelliJ developers, consider using NetBeans IDE that provide comprehensive support for GlassFish. Developing/deploying a Web service on GlassF…

    Comment by Arun Gupta's Blog — May 1, 2007 @ 7:19 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress