Home > Documentation > Developing > Tutorials > Developing 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
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.
Calculator_schema1.xsd
and Calculator.wsdl
will be generated at C:/WSDL/
. Calculator.wsdl
as CalculatorService.wsdl
and add both the generated files to WEB-INF directory of the project.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.
index.jsp
:
result.jsp
:
Bookmark this on Delicious Digg this | Privacy Policy - Copyright © 2003-2013, The Apache Software Foundation, Licensed under ASL 2.0. |