|Home > Documentation > Developer's guide > Tutorials > Web services > Developing a simple Calculator Web Service|
This tutorial will walk you through building and developing the jax-ws calculator that ships with the samples package for Geronimo. After completing this tutorial, you should be able to understand how to build simple web services with Apache Geronimo 2.1 using the Eclipse development environment
To run this tutorial, as a minimum you will be required to have installed the following prerequisite software.
Details on installing eclipse are provided in the Development environment section. This tutorial is organized in the following sections:
The application development will take you through the following
Group ID: A name that identifies the group of a module. The default value is default.
Artifact ID: A name of the module in a group. The default value is <blank>.
Version: The version of module. The default value is 1.0
Type: The type of module, such as system module (car), jar module (jar), web
archive (war), enterprise archive (ear), and so on. The default value is car
A module is stored inside a repository as repository/groupId/artifactId/version/artifactIdversion.
type. This repository structure gives a more standardized and easily maintainable
structure to Geronimo applications.
Depending upon your environment, you may see the error message "Failed while installing Axis2 Web Services Core 1.1". Do not worry. We will just have to manually point Axis2 to the installation directory of Apache Geronimo to fix this error.
To implement the Calculator we are going to create a package org.apache.geronimo.samples.jws. This package will contain 2 classes. A Calculator Interface, and CalculatorService which implements the Calculator interface. Lets go step by step with creating the package, interface class and implementation class.
Let us try to understand each annotation
This completes the development of the Web Service Implementation code.
Geronimo provides a new jaxws-tools.bat which helps in generating the WSDL file from service endpoint interface.
In this command -classpath is used to set source.jar(exported from eclipse) in the classpath, -d defines the location where all the generated artifacts will be placed, -wsdl:soap1.1 suggests a wsdl generation following soap1.1 protocol, org.apache.geronimo.samples.jws.CalculatorService is the SEI used to generate the WSDL.
|Why are we using gsh if we already have a jaxws-tools.bat|
This is because there are some issues involved with jaxws-tools.bat in AG 2.1 so we are using a gshell to call the web services generator.
To learn more about GShell refer Gshell section in user guide. To know about more options associated with jaxws. Run jaxws/wsgen -help or jaxws/wsimport -help from gshell.
This section will take you through the creation of two jsp's index.jsp and result.jsp.index.jsp will prompt the
user to enter two whole number values to add together. After submitting the form, the action will be forwarded to result.jsp. Result.jsp will call the Calculator add Web Service.
This finishes the development of Web client.