Thursday February 01, 2007
Web services in IntelliJIDEA using the Web Services plugin
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:
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:
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).@javax.jws.WebService
annotation and so the class looks likepackage hello;
@WebService
public class Hello {
public String sayHello(String name) {
return "Hello " + name;
}
}So far we have been able to deploy a JAX-WS based Web service and now we will invoke it.
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.public class HelloClient {
public static void main(String[] args) {
System.out.println(new HelloService().getHelloPort().sayHello("Duke"));
}
}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
Posted by Arun Gupta in webservices | Comments[2]
|
|
|
|
|
Today's Page Hits: 3591
Total # blog entries: 1002
Posted by Arun Gupta's Blog on February 10, 2007 at 10:36 AM PST #
Posted by Arun Gupta's Blog on July 10, 2008 at 06:06 AM PDT #