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_1
directory created by the extraction process.Set the
JAVA_HOME
andJBOSS_HOME
environment variables to point to where your JDK and JBoss 4.0 are installed. Examples:Windows: C:\workbook\ex15_1> set JAVA_HOME=C:\jdk1.4.2 C:\workbook\ex15_1> set JBOSS_HOME=C:\jboss-4.0
Unix: $ export JAVA_HOME=/usr/local/jdk1.4.2 $ export JBOSS_HOME=/usr/local/jboss-4.0
Add
ant
to your execution path. Ant is the build utility.Windows: C:\workbook\ex15_1> set PATH=..\ant\bin;%PATH%
Unix: $ 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
ant
clean.db
.
Build and Deploy Example Programs
JBoss implements ...
Get Enterprise JavaBeans, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.