GlassFish v2 supported in IntelliJ Web Services Plugin

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

Comments:

[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...

Posted by Arun Gupta's Blog on May 01, 2007 at 12:19 PM PDT #

Post a Comment:
Comments are closed for this entry.
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today