In this second part of a blog series (part 1), I plan to explore the steps to develop/deploy/invoke a Web service on GlassFish using IntelliJIDEA IDE.
Searching in the help bundled with the IDE on "web service from Java" returned no results relevant to Web service. I found several (1,2,3) people asking "How do I develop Web service in IntelliJ 6.x?" but all the questions are unanswered. The online documentation does not seem to talk anything about Web service. Searching on intellij.org gave no results. Finally I found some lead after searching in the forums but there is no help on "Enable Web Service Support" as mentioned in the post. Another response in the forum requires you to add @javax.jws.WebService manually, pretty primitive. So I decided to ask the question (1, 2) in the forum.
After discussion in the forum I found that IntelliJ does not support creation of Web services natively but instead support it through a Web service plugin. The plugin, at the time of this writing is "0.6 build 2" with few skeptical comments but anyway worth a try. This plugin supports JWSDP 2.0 so first I’ll investigate how Web services can be deployed on GlassFish and then come back to this plugin.
Here are the steps I followed to successfully build and deploy a Web service:
Create a Web module (requires 12 clicks for default settings), say with name "hello". On Deployment Descriptors tab, select the default "Web Module Deployment Descriptor" and delete it as shown here. This is not required for deploying a Web service in GlassFish v2. Take all other defaults.
In the "Project" pane, click on "src", add a new package "hello" as shown here.
Select the package "hello", add a new class "Hello" as shown here.
Click on the Project, right-click and select "Module Settings". Select the module and remove "j2ee.jar" as shown here. Add a new module library, javaee.jar, from GlassFish lib directory as shown here.
Add @javax.jws.WebService annotation to the class and add a method as shown:
@WebService public class Hello { public String sayHello(String name) { return "Hello " + name; } }
Configure and Run GlassFish v2 in IntelliJ. I added GlassFish v2 M4 using the following steps.
Select "Run", "Edit Configurations …" menu.
Click on "+" in top-left corner to add a new configuration and then select "GlassFish Server" and "Local" as shown here.
Specify the location of GlassFish by clicking on "Configure" button.
Select the domain (default value "domain1") in "GlassFish Server Settings".
Add a new server by clicking on "+" in top-left corner and give the location where GlassFish is installed as shown here. Ignore the "There are no modules to deploy" warning as this will be fixed during Run. Now GlassFish is configured.
To run the GlassFish instance
Select "Run", "Run" (default shortcut Shift+F10) menu item.
Run configuration window displays the warning message "There are no modules to deploy". Go to "Deployment" tab and selecting the newly created module to deploy as shown here .
Check "Deploy Web Module" check box and click "Configure" button and select "Create web module war file". A warning is displayed "Warning: ‘Glassfish Web Module Deployment Descriptor’ is not defined" as shown here. This message can be ignored as no GlassFish specific deployment descriptors are required.
Click "Run" button.
Once the GlassFish server has started, the endpoint is hosted at http://localhost:8080/hello/HelloService?wsdl.
The key point to note here is that no Deployment Descriptors (either standard or application serve specific) are required in the WAR file. The deployed WAR file in GlassFish consists only of the compiled class.
The only way IDEA support creation of Web service clients is through Web Services plugin so I’ll explore it in another blog. So the recommended way is to use NetBeans 5.5.1 to invoke the Web service.
Enjoy Web services deployed on GlassFish in IntelliJIDEA! And remember, GlassFish v2 uses Web Services Interoperability Technology (WSIT) that gives you interoperable Web services with Microsoft .NET 3.0 framework.
Mon: 3.5 miles Tue: 3.5 miles Wed: 3.5 miles Thu: 3.5 miles Fri: 7 miles Sat: Rest Sun: Rest
With a total of 21 miles so far in the week and the upcoming weekend, I plan to have two more weeks with similar mileage and then start my marathon training.
This day is a national holiday in India and celebrated with pride. One of the many events around this day is the Republic Day Parade. As a child, I used to enjoy a live telecast of this parade on television followed by in-person enjoying the prowess of Indian Armed Forces as the parade used to end near our house on Red Fort of Delhi.
An important point to note in the article is the 1000% performance gains between EA and and more recent versions of JAX-WS. Not all of this gain may be due to JAX-WS
GlassFish is supported in NetBeans, IntelliJ IDEA and Eclipse. I’m starting a 3-part blog that will explain my experience in developing, deploying and invoking a Web service in each of these IDEs. Today, I start with NetBeans.
I’m using NetBeans 5.5.1 for the experiment purpose but these features are available NetBeans 5.0 onwards. Here are the steps that I followed.
Install GlassFish: Before you begin, make sure a GlassFish instance is configured in NetBeans. If not, then it can be added by right-clicking on "Servers" in the "Runtime" tab and selecting "Add Server" and picking the directory location where GlassFish is installed. I configured GlassFish v2 b31.
Add a Web service: Right-click on the project name and select "New", "Web Service …". Take the defaults and just specify the package name. Click on "Finish" button. The IDE creates a template Web service and adds a new Web services node to your project.
Add an operation: Expand the Web service node and select the newly created Web service. Right-click and select "Add Operation" as shown here.
Implement the logic: Implement the business logic, in this case returning a simple concatenation of strings "Hello " and the parameter.
Deploy the Web service: Right-click on the project and select "Deploy Project".
Invoke the Web service: Once deployed, as reported in the Output window, right click on Web service name in the Projects tab and select "Test Web Service". This brings up a web page in your default browser to test the Web service. You can view the WSDL of the Web service by clicking on "WSDL File" link and invoke it by entering a value in the text box. The result page shows you the result of Web service invocation and SOAP request and response messages.
I find it weird that Netflix do not have their phone number listed on website in case you want to talk with an actual human being. I finally found it here after Googling. The number is listed below for convenience:
1-888-638-3549 or 1-888-NET-FLIX, Mon-Fri, 6am – 7pm PT
This number was posted a year ago and there are lots of readers who have complained with their number not listed. I’m thinking of switching to BlockBuster Total Access because of the additional convenience to exchange in store.
Marathon running is gaining momentum as there is a 5.9% growth in the number of marathon finishers over 2004, as reported in USA Marathoning: 2005 overview. The page also shows how the gender divide is reducing in the past few years. Silicon Valley Marathon does not have enough participants to qualify for this report. But San Francisco Marathon (running later this year) is ranked 18th with a growth of 82.9% over year 2004. The average time to finish the marathon in my age range is 4:25:28 so I’m above average comparing my finish time (4:06:57) from last year. The month of October (same month for Silicon Valley) accounted for more than one-quarter of all marathon finishes.
A prelim report on 2006 at marathonguide.com also shows a similar trend in terms of growth: approximately 397,000 marathon finishes, 3.7% increase over 2005. A more detailed report is expected later this month and I’ll post a link when it’s available.
I ran my first marathon last year and so eagerly waiting for complete 2006 statistics.