Miles to go …

January 31, 2007

Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse – Part 2

Filed under: webservices — arungupta @ 5:12 pm

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:

  1. 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.
  2. In the "Project" pane, click on "src", add a new package "hello" as shown here.
  3. Select the package "hello", add a new class "Hello" as shown here.
  4. 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.
  5. 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;
      }
    }

  6. Select "Build", "Make Project" (default shortcut Ctrl+F9).
  7. Configure and Run GlassFish v2 in IntelliJ. I added GlassFish v2 M4 using the following steps.
    1. Select "Run", "Edit Configurations …" menu.
    2. Click on "+" in top-left corner to add a new configuration and then select "GlassFish Server" and "Local" as shown here.
    3. Specify the location of GlassFish by clicking on "Configure" button.
    4. Select the domain (default value "domain1") in "GlassFish Server Settings".
    5. 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.
    6. To run the GlassFish instance
      1. Select "Run", "Run" (default shortcut Shift+F10) menu item. 
      2. 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 .
      3. 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.
      4. Click "Run" button.
  8. 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.

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

January 29, 2007

Gmail “Server Error”

Filed under: General — arungupta @ 6:43 pm

Not just me but multiple other folks have seen it at different times. Read 1, 2, 3, 4, and many others.

How can such a service be a down ? May be that’s why they are still in BETA.

UPDATE: Yet again, GMail was down for 12 hours on Mar 1, 2007. The timing of this new GMail promotional video seems to be ironical ;-)

Technorati: Google Gmail Error

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 27, 2007

Google in Microsoft

Filed under: General — arungupta @ 9:59 pm

Just read an interesting statistics … approx 66% of Microsoft employees use Google, not MSN :)

Technorati: Microsoft Google MSN

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 26, 2007

7-miler this morning

Filed under: Running — arungupta @ 12:11 pm

This week has been a good running week:

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.

Many more miles to go before the run :)

Technorati: running training fitness runninglog

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

58th Republic Day of India

Filed under: General — arungupta @ 10:28 am

Today is the Republic Day of India. This day, 58 years ago, Constitution of the Country came into force thereby defining it as a Sovereign Socialist Democratic Republic with a Parliamentary form of Government, through the Preamble. The Indian Constitution, which was adopted by the Constituent Assembly after considerable discussions represented the framework of the Government of the Country.

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.

Check a webcast of 2007 parade here, deja vu.

Wishing all fellow readers a happy republic day.

Technorati: republic day india national holiday

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 24, 2007

JAX-WS on JBoss

Filed under: webservices — arungupta @ 8:00 am

Read about a customer experience on using JAX-WS RI on JBoss on the server side and JAX-WS runtime with Java SE 6 on the client side.

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 :)

Technorati: JAXWS JAX-WS JBoss Web services

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 23, 2007

Thanks Sun!

Filed under: General — arungupta @ 12:52 pm

I’m glad to be a Sun employee helping change the world.

Technorati: sun youtube

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse – Part 1

Filed under: webservices — arungupta @ 8:00 am

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.

  1. 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.
  2. Create a project: Create a new Web application project by selecting "File", "New Project". Take all the defaults.
  3. 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.
  4. Add an operation: Expand the Web service node and select the newly created Web service. Right-click and select "Add Operation" as shown here.
  5. Implement the logic: Implement the business logic, in this case returning a simple concatenation of strings "Hello " and the parameter.
  6. Deploy the Web service: Right-click on the project and select "Deploy Project".
  7. 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.

These steps are described in NetBeans help after I searched on "web service from Java" in the bundled help. Googling for this term (along with NetBeans) gave me Create a Web Service Using NetBeans 5.0 IDE and Consume the Service with Sun Java Studio Creator 2 IDE and Web Services Support in  the NetBeans IDE. Both the links contain the appropriate content and provide all the information required for a newbie to get started.

Next, I’ll try with IntelliJ IDEA and Eclipse.

Technorati: NetBeans IntelliJ Eclipse GlassFish Web services

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 22, 2007

Netflix Phone Number

Filed under: General — arungupta @ 12:30 pm

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.

Technorati: Netflix Blockbuster Movies

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

January 21, 2007

Marathon running is gaining momentum

Filed under: Running — arungupta @ 6:18 pm

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.

Technorati: Marathon Running 2005 2006 Overview

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Older Posts »

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