|Developing a JAX-WS POJO Web Service||Developing Web services||Developing Clients for a JAX-WS 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
using the Eclipse development environment.
To run this tutorial, as a minimum you will be required to have installed the following prerequisite software.
Geronimo version 2.2, Java 1.6 runtime, and Eclipse Ganymede are used is used in this tutorial but other versions can be used instead (for example, Geronimo version 2.1, Java 1.5, Eclipse Europa)
Details on installing eclipse are provided in the Development environment section. This tutorial is organized in the following sections:
A separate Axis2 runtime is required for use by the Eclipse Axis2 project facet. You can use the pre-integrated Axis2 1.4 binaries (axis-1.4.jar) from the local Geronimo repository under <Geronimo_home>/repository/axis/axis/1.4
To implement the Calculator Web service we are going to create a package called org.apache.geronimo.samples.jws. This package will contain two classes: a Calculator interface, and a CalculatorService which implements the Calculator interface. Let's 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 the 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, and org.apache.geronimo.samples.jws.CalculatorService is the SEI used to generate the WSDL.
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 the result.jsp, which will call the Calculator Web Service.
This finishes the development of Web client.