Arun Gupta, Miles to go ...

Arun Gupta is a technology enthusiast, a passionate runner, and a community guy who works for Sun Microsystems.
« Previous month (Dec 2006) | Main | Next page of month (Jan 2007) »

http://blogs.sun.com/arungupta/date/20070131 Wednesday January 31, 2007

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

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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070129 Monday January 29, 2007

Gmail "Server Error"

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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070127 Saturday January 27, 2007

Google in Microsoft

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

Technorati: Microsoft Google MSN

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070126 Friday January 26, 2007

7-miler this morning

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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

58th Republic Day of India

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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070124 Wednesday January 24, 2007

JAX-WS on JBoss

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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070123 Tuesday January 23, 2007

Thanks Sun!

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

Technorati: sun youtube

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

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

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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070122 Monday January 22, 2007

Netflix Phone Number

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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070121 Sunday January 21, 2007

Marathon running is gaining momentum

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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070119 Friday January 19, 2007

New WSIT Plug-in coming

What does GlassFish v2 + NetBeans 5.5.1 IDE + WSIT plug-in give you ?

If you read my blog, then you know the answer. If not, then this is a recipe to create Interoperable (with Microsoft .NET 3.0 framework), Secure, Reliable, and Transactional Web services easily in an intuitive manner.

If you use NetBeans Update Center to install the WSIT plug-in, then the version released with WSIT Milestone 2 will be installed. The plug-in has been updated since then (see below on how to install the updated plug-in) for the reasons given below.

  • The plug-in is now a module suite consisting of two NetBeans modules (.nbm files), "Web Services Interoperability Technology Support" (WSIT Support) and "Web Services Interoperability Technology WSDL Extensions" (WSIT WSDL Extensions). The WSIT Support  module relies upon the WSIT WSDL Extensions module and allows a cleaner separation between the view (UI) and the model (WSDL). On the NetBeans Update Center (when they are available), these modules will be available as one download option keeping it simple for you.
  • Splitting the module into two allows modularization and only the required module to be loaded. 
  • The WSIT configuration (reached by clicking "Edit Web Service Attributes";) is now more intuitive and extensible. Instead of splitting into two separate tabs (Messaging and Security), all the WSIT feature can be configured on one tab. This makes configuring multiple attributes such as security and reliability easy for and endpoint.

How to install the plug-in ?

  1. If a WSIT plugin is already installed, it is recommended to uninstall it. Go to Tools, Modules Manager menu and select the "Web Services Interoperability Technology Support" module and click on Uninstall. You may have to Sort the module names by Name to view the module.
  2. Download the updated modules.
  3. Click on Tools, Update Center menu and choose the "Install Manually Downloaded Modules (.nbm files) ". Follow rest of the process from here. The selected modules will look like this.
  4. Once installed, the modules will appear in Tools, Module Manager window as shown here

These new modules will replace the existing WSIT module when the the next WSIT milestone is released.

Technorati: WSIT GlassFish NetBeans Web service

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070115 Monday January 15, 2007

JavaOne 2005 & 2006 Archive

JavaOne 2007, although 4 months away, but the machinery at Sun already started to make sure that this year is improved and better than earlier years. For example, you can look at the WSIT preso from 2005 and 2006 and see how the content, quality and reality has improved. The technical session archives from 2005 & 2006 will give you an idea about the previous years.

If you are interested in saving $200, then register today for JavaOne 2007 - the biggest world wide Java developer conference.

Technorati: JavaOne Java WSIT presos

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070114 Sunday January 14, 2007

Started pre-training runs

Started my pre-training runs this morning with a 3.5 mile run. I'm hoping to reach 20-25 miles average in next 3 weeks and then will start my training for my upcoming marathon.

Technorati: Running Marathon runsfm

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070113 Saturday January 13, 2007

WSIT and Web 2.0 at Atlanta Tech Days

Sun Tech Days is Sun's World Wide Developer Conference. The next venue is Atlanta, United States on Jan 16-17, 2007.

The complete agenda is very comprehensive consisting of a NetBeans day, OpenSolaris Day and technical sessions on Java SE and Java EE, Solaris OS, Tools and Web 2.0. And the best part is, all this is FREE. I'm presenting on:

  • Technologies and Tools for Web 2.0 (11:50 - 12:40pm)
  • JAX-WS and WSIT: Tangoing with .NET (2:40 - 3:30pm)

You can also take a full-day deep dive in development led by a master instructor for a modest price. The details are at the bottom of the agenda page. If you have not registered yet, in the vicinity of Atlanta, and would like to jump start your career - do it now.

The Sun Tech Days 2006 - 2007 World Tour schedule is available in the right column here.

Technorati: sun suntechdays netbeansday netbeans opensolarisday opensolaris wsit web2.0 presos

del.icio.us | furl | simpy | slashdot | technorati | digg |
|

http://blogs.sun.com/arungupta/date/20070112 Friday January 12, 2007

Gadget loaded toilet from Roto Rooter

Want to win HDTV, iPod with dock, TiVo, Xbox 360, DVD player, Laptop, Bullhorn, Bike pedals, Beer tap and Refrigerator - all together ?

But before you decide, you need to understand that you will not be able to put these fancy gadgets in your family room. Instead all of these are going to come pre-installed on the latest toilet from Roto Rooter. It seems you can win this ultra-techie toilet on a contest starting on Roto's website starting on 24th of this month. And of course it has a button for emergency calls to Roto Rooter.

Technorati: xbox360 ipod hdtv toilet rotorooter

del.icio.us | furl | simpy | slashdot | technorati | digg |
|
« Previous month (Dec 2006) | Main | Next page of month (Jan 2007) »

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.