206
Scenarios for Web Services Based Client Applications
...
...
J2EE Container
Submit
Purchase Order
Web Service
orderId
EJB Endpoint
...
JMS
...
Queue
Credit Card
Web Service
Synchronous
Process
call
Purchase Order
Message Driven Bean
Shipping
Asynchronous
call
Web Service
Figure 5.3
EJB Components and Web Services in a Workflow
In this example, a Web component calls the order tracking service and, when
it receives a response from the service, it puts the results in a Java Beans compo
nent (
OrderDetailsBean
) that is within the request scope. The Web component
uses a JSP to generate an HTML response, which the container returns to the
browser that made the original request.
It is also possible to write J2EE clients using EJB components. (See Figure
5.3.) These EJB components may themselves be Web service endpoints as well as
clients of other Web services. Often, EJB components are used in a workflow to
provide Web services with the additional support provided by an EJB container
that is, declarative transactional support, declarative security, and life cycle man
agement.
Figure 5.3 demonstrates a workflow scenario: a Web service endpoint used in
combination with a message driven bean component to provide a workflow oper
ation that runs asynchronously once the initial service starts. The Web service
endpoint synchronously puts the purchase order in a JMS message queue and
returns an
orderId
to the calling application. The message driven bean listens for
New Page 1