Chapter WORKBOOK 15. Exercises for Chapter 19
Chapter 19 of the EJB book explained the web services APIs available in EJB 3.0. The exercises in this chapter walk you through exposing and using an EJB as a web service.
Exercise 19.1: Exposing a Stateless Bean
This exercise exposes TravelAgentBean
, which was developed in
Chapter 4, as a web service
using JAX-WS. To demonstrate interoperability, and to provide example
material for the JAX-RPC sections, the client that calls TravelAgentBean
will use the JAX-RPC API. We
will begin by building and deploying the EJB-JAR and the Java EE application client JAR.
Start Up JBoss
Start up JBoss as described in Workbook 1.
Initialize the Database
You do not need to create any database tables because we will use the same persistence configuration in the exercises for Chapter 4, which will generate the tables automatically.
Build and Deploy the Example Programs
Perform the following steps:
Open a command prompt or shell terminal and change to the ex19_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\ex19_1> set JAVA_HOME=C:\jdk1.5.0 C:\workbook\ex19_1> set JBOSS_HOME=C:\jboss-4.0.x
- Unix:
$ export JAVA_HOME=/usr/local/jdk1.5.0 $ export JBOSS_HOME=/usr/local/jboss-4.0
Add
ant
to your execution path. Ant is the build utility.- Windows:
C:\workbook\ex19_1> set PATH=..\ant\bin;%PATH%
- Unix:
$ export PATH=../ant/bin:$PATH
Perform the ...
Get Enterprise JavaBeans 3.0, 5th 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.