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.Set the
JAVA_HOMEandJBOSS_HOMEenvironment 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.0Unix: $ export JAVA_HOME=/usr/local/jdk1.4.2 $ export JBOSS_HOME=/usr/local/jboss-4.0Add
antto 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access