Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: prefix pages with app name so order is the same as in svn
Wiki Markup
{scrollbar}

Application Overview
Anchor
application
application

The sample application referred in this article is a simple calculator which performs addition of two integers. The client application referred here is not a J2EE application. It is a regular Java client which will call a web service to carry out the application functionality. Web service is exposed as a Servlet in the Geronimo application server.

Service implementation

The Calculator interface defines the Service Endpoint Interface (SEI) for the Web Service.

...

Info
titlewebservices.xml

In J2EE version 1.4, the webservices.xml file was also necessary to describe the Web Service. In Java EE 5 that file is optional and is not required in this example.

JSP-based JAX-WS client

The add.jsp is a basic client for the CalculatorService Web Service.

...

Note
titleResource injection in JSP

Since the resource injection is not supported in JSPs the service-ref must be added explicitly to the web.xml file.

Building and Deploying Sample Application
Anchor
configure
configure

Checkout the sample source code from SVN:

...

The source code will be checked out into the calculator/ directory. This sample code code lives in calculator/jaxws-calculator-war/ directory.

Required Tools

The tools used for developing and building the Calculator sample application are:

Apache Maven 2.0.x

Apache Maven is used for building the Calculator application.

Building

Compile Source Code

From command prompt execute the following command in the calculator/jaxws-calculator-war/ folder:

...

After the code is successfully compiled a jaxws-calculator-war-2.0-SNAPSHOT.war file will be created in the target/ subfolder.

Deploying

Deploy the jaxws-calculator-war-2.0-SNAPSHOT.war using the Geronimo Console (http://localhost:8080/console):

  1. Scroll to Deploy New from the Console Navigation panel.
  2. Load jaxws-calculator-war-2.0-SNAPSHOT.war from calculator/jaxws-calculator-war/target/ folder in to the Archive input box.
  3. Press Install button to deploy application in the server.

Testing of the Sample
Anchor
testing
testing

To test this sample service use the add.jsp (http://localhost:8080/jaxws-calculator/add.jsp) to invoke the Web Service. Once the JSP page loads type in two values to add and press the Add button. The result of the addition should show up below. For example:

...