GlassFish v2 supported in IntelliJ Web Services Plugin
Posted by arungupta on February 10, 2007 at 1:36 PM EST
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" to "0.7 build 1" as shown here.
- Using Project Settings (default shortcut Ctrl+Alt+S), configure GlassFish in the Web Services plugin as shown here.
- 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.
- Following Steps 4, 5, and 6 from the previous
blog, I added the
@javax.jws.WebServiceannotation 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". - To configure and run the GlassFish instance and deploy the newly created module, follow the instructions as shown in Step 7 here.
- 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:
- Add a new "Java Module" to the project by selecting "File", "New Module".
- 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.
- 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"));
}
} - Build the module by selecting "helloclient" node, right-click, selecting "Make module "helloclient"".
- Add add
activation.jaras a module library as shown here. - Right-click HelloClient, select "Run "HelloClient.main()"" (default shortcut Ctrl+Shift+F10).
- 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
Related Topics >>
Blog Links >>
- Login or register to post comments
- Printer-friendly version
- arungupta's blog
- 978 reads





