Chapter 31. Exercises for Chapter 15
Exercise 15.1: Web Services and EJB 2.1
In this exercise, you will learn how to use JAX-RPC’s client and server-side programming model with EJB 2.1. You will expose a stateless session bean as a web service. You will also investigate how to connect to and invoke on an existing web service from within EJB code. The stateless session bean that is exposed models the TravelAgentEndpoint in Chapter 15 of the EJB book. The supporting code for the rest of this exercise is borrowed from the exercises for Chapter 11 (Workbook 8). This exercise also introduces another stateless session bean that acts as a JAX-RPC client to the TravelAgentEndpoint EJB.
Initialize Your Environment
Perform the following steps:
Open a command prompt or shell terminal and change to the
ex15_1directory created by the extraction process.
JBOSS_HOMEenvironment variables to point to where your JDK and JBoss 4.0 are installed. Examples:
C:\workbook\ex15_1> set JAVA_HOME=C:\jdk1.4.2 C:\workbook\ex15_1> set JBOSS_HOME=C:\jboss-4.0
$ export JAVA_HOME=/usr/local/jdk1.4.2 $ export JBOSS_HOME=/usr/local/jboss-4.0
antto your execution path. Ant is the build utility.
C:\workbook\ex15_1> set PATH=..\ant\bin;%PATH%
$ export PATH=../ant/bin:$PATH
Clean the Database
You need to clean and refresh the database. To do this, first
shutdown JBoss if you have it running and then run the
Build and Deploy Example Programs
JBoss implements ...