This sample shows the SCA
stateless session bean binding support. The stateless session bean binding is a
protocol binding which provides the ability to integrate SCA with EJB based
services.
1) The Reference binding enables SCA components to invoke stateless session
beans
2) The Service binding exposes an SCA service as a stateless session bean for
consumption by J2EE applications
Flow
This sample shows how to
invoke a SCA component using JEE programming model and how a component with an
EJB reference binding can invoke a stateless EJB which is in
JobbankTargetEJBApp.
The non-SCA, J2EE client packaged within JobbankClientApp invokes the ‘Company’ service which is exposed over the EJB binding. This Company service is invoked as a normal EJB, then, from the perspective of the client application, without awareness that the client is invoking an SCA service exposed over the remote EJB service binding. The Company component, in turn, contains a reference to a ResumeBank EJB, which it invokes using the simple SCA programming model. This reference is configured using the EJB reference binding to point to a Stateless Session bean packaged within the JobbankTargetEJBApp application. The simple SCA programming model allows the Company component to invoke the ResumeBank EJB service using a simple POJO-like invocation without having to use JEE client APIs.
Artifacts involved
Prerequisites and Setup
1. This sample application requires that you have the WebSphere Application Server and the SCA Feature Pack installed.
Part 1: Inspect and build the EJB Binding sample applications
Compile and build the installable
artifacts using the provided ANT build script.
JobbankClientApp.ear
jobbankejb.jar
JobbankTargetEJBApp.ear
Part 2: Install and start SCA composite
1. Start the
WebSphere Application Server if it is not already started.
__ a. Open a command window and issue the following command
cd <WAS_HOME>\profiles\<PROFILE_NAME>\bin
Example
command:
cd C:\WebSphere\AppServer\profiles\AppSrv01\bin
__ b. Issue the startServer command
startServer server1
2. Use the Administrative Console to import jobbankejb.jar
__ a. Open a Log into the Administrative Console by navigating to http://localhost:9060/admin in a Web browser.
__ b. From the left navigation panel of the Administrative console, expand Applications then Application Types and select Assets.
__ c.
Press the Import button, then
browse to <WAS_HOME>\samples\jobbankejb\target\
and select the jobbankejb.jar file.
Click Next using all the default
settings until you reach the summary page and click Finish.
__d. Click the Save link at the top of the screen.
3. Use the Administrative Console to create the Business-level Applications that will run the SCA composites.
__ a.
From the left navigation panel of
the Administrative console, expand Applications
and select Application Types and
then Business-level Applications and
click on New.
__
b.Fill in jobbankejb for name and click Apply.
__ c. Click the Save link at the top of the screen.
__ d. Go to Applications and select Applicaton
Types and then Business-level
Applications. Then click on jobbankejb.
__ e. Under Deployed Assets click
on Add and choose Add Asset. Select jobbankejb.jar and click Continue.
__
f. Click Next until the last panel
and then click Finish.
__
g. Click the Save link at the
top of the screen, and return to Applications
and select Application Types and
then Business-level Applications. Select
the jobbankejb checkbox and click on Start.
Part 3: Install target EJB
Use the
Administrative Console to install target EJB application
__ a.
From the left navigation panel of the Administrative console, expand Applications and then select New Application and select New
__ b.
On the install panel, specify the Local file system option and enter the Full
path or use the browse button to select the JobbankTargetEJBApp.ear file located in the <<WAS_HOME>\samples\jobbankejb\target\ directory. Click Next.
__ c. For the remaining install panels, select
the defaults by clicking Next until
you reach the final panel. Click Finish to complete the installation of
the sample application.
__ d. The application will appear in the
list of applications and its initial status will be stopped” (Status of
Red). Expand Applications
then Application Types and select WebSphere enterprise applications.
Check the box next to JobbankTargetEJBApp and press Start.
Part 4: Running the sample
where
i.
WAS_HOME =
Websphere home directory
ii.
YOUR_PROFILE_NAME
= your profile name
iii.
YOUR_CELLNAME = Your
Cell name under "installedApps" under your profile
iv.
-CCBootstrapHost
= hostname
v.
-CCBootstrapPort=
Bootstrap port for your Websphere instance
vi.
These settings
are needed to bootstrap the WAS J2EE client container.
It will look something like:
INVOKING
SCA COMPONENT THROUGH COMPONENT SERVICE WITH EJB BINDING
Getting
company info for Company: ACME Corp
Result
from SCA Component. Company type: Software firm
INVOKING
COMPONENT SERVICE->COMPONENT->COMPONENT REFERENCE->EXTERNAL EJB
Posting
resume: John Doe
Confirmation
number: 1559740348