Before you start
This tutorial is Part 1 of a two-part series that explains and demonstrates the integration of enterprise Web services into J2EE running on Geronimo.
This part of the series demonstrates the integration of service-consumer and service-provider Web services into the existing J2EE-based BookShop application. The second part of the series will demonstrate several additional aspects that are likely to be required when using enterprise Web services in Geronimo: security, attachments, registry access, and logging.
This tutorial will introduce you to some of the APIs required for the integration of Web services into a classic J2EE application. BookShop is a classic J2EE-based book-selling application that is deployed on Apache Geronimo, a J2EE 1.4-compliant application server. The original BookShop application lets customers search for books based on categories and is exclusively targeted at customers using a Web browser. Search results include the book title, author names, ISBN, description, and price in U.S. dollars. The application consists of a JavaServer Pages (JSP) component, a servlet, one session Enterprise JavaBean (EJB), and three entity EJBs that access a relational database. You'll learn how to extend BookShop by incorporating two J2EE-compliant Web services into the application -- one that delivers current exchange rates to let BookShop calculate book prices in multiple currencies and one that enables business-to-business (B2B) access by nonbrowser clients. The examples you'll work through demonstrate both service-consumer and service-provider scenarios.
The tutorial is structured as follows:
- Extending BookShop with JAX-RPC presents an architectural overview of the BookShop example, clarifying the impact on the original application of extending it with Web services. It also gives a brief conceptual overview of the Java APIs for XML-Based Remote Procedure Call (JAX-RPC) and its integration into Geronimo.
- Exposing Web services from BookShop demonstrates the steps required on the server side of the BookShop application to expose two Web services.
- Web services clients in BookShop shows two ways to access the two external Web services from the J2EE-based BookShop application. It also shows a Java 2 Platform, Standard Edition (J2SE) client application that can access the Web services -- the JAX-RPC service endpoints (JSEs) and EJB endpoints -- exposed by the extended BookShop application.
- Required deployment artifacts describes the deployment artifacts necessary for successful implementation of the extended BookShop application.
- BookShop in action covers deployment and testing of the BookShop application on both the client and server sides.
Java developers with prior experience in J2EE platform development are the primary audience for this tutorial. General knowledge of distributed programming concepts and the role of Web services in this context is beneficial but not required.
To run the example code in this tutorial, you need to perform the following steps:
- Download and install the following applications and libraries:
- Optionally, download and install the Eclipse SDK.
- Make sure that the environmental variables in Table 1 are set in your shell.
Table 1. Setting the environmental variables
| Variable name | Required setting |
|---|---|
GERONIMO_HOME
| Set to the root folder of your Geronimo installation |
ANT_HOME
| Set to the root folder of your Ant installation |
JAVA_HOME
| Set to the root folder of your Java installation |
AXIS_HOME
| Set to the root folder of your Axis installation |
AXIS_LIBRARIES
| Set to all libraries in AXIS_HOME/lib |
PROJECT_HOME
| Set to the root folder of the BookShop application |
PATH
| Include JAVA_HOME/bin, ANT_HOME/bin, JWSDP_HOME and JWSDP_HOME/jaxrpc/bin |
- Create a database called
bookshopdbin MySQL, and then run the supplied database script (etc/bookshopdb.sql) to create and populate the required relational-database tables. - Create a folder in %GERONIMO_HOME%/repository/mysql/jars, and copy the mysql-connector-java-your_version_number.jar driver to this directory.
- Edit the geronimo-ra.xml database deployment plan found in %PROJECT_HOME%/etc by updating your exact MySQL Connector/J driver name, username, password, and server name as required.
- Edit the build.xml project to set the correct paths for your Geronimo and Axis installations. Also, look into %GERONIMO_HOME%/repository/tranql/rars and adjust the TranQL file name in the build.xml file accordingly.

