296 Patterns: Implementing Self-Service in an SOA Environment
Figure 10-3 Component model diagram
A Web service call to HomeDelivery invokes the HomeDelivery inbound service
on the bus. The destination representation for the HomeDelivery service has a
mediation that looks at the request and makes a routing decision based on the
delivery service requested by the client. The request could be routed to the
HomeDelivery service, the BusinessDelivery service or both. If both services are
called, a second mediation intercepts the responses and combines them into one
response.
10.2.2 Object model
In this section we provide an object model for our Web services scenario.
Class diagram for CreditCheckClient
Figure 10-4 on page 297 shows a class diagram of the classes directly involved
with providing Web services for the CreditCheckClient application.
On the requester side, the ProcessorWebService bean from the ITSOMart
application requests the credit rating using the CCWSClientBean EJB.
CCWSClientBean is the Web services requester bean, serving as the interface
between the ITSOMart application and the CreditCheck Web service. As far as
the application knows, it is simply calling a local method called
returnSimpleQuote on this bean and expects a credit rating to be returned.
Self Service Application
Processor EJB Module
HomeDelivery
Client Proxy
DeliverySystem Application
Service Integration Bus
Web Service
Destination
HomeDelivery
Data Binding
HomeDeliveryBean
HomeDelivery EJB Module
BusinessDelivery
Data Binding
BusinessDeliveryBean
BusinessDelivery EJB Module
Router
Mediation
Aggregator
Mediation
Chapter 10. Web services scenario 297
On the provider side, a stateless session EJB called CreditCheck serves as the
Web services bean for the provider. In a real application, this bean would
probably act as a facade to the actual enterprise business objects. It knows
which enterprise objects to call in order to retrieve the information it needs to
create a response to the Web services request.
Figure 10-4 Class diagram of the CreditCheckClient application
Class diagram for ClientDelivery
Figure 10-4 on page 297 shows a class diagram of the classes directly involved
with providing Web services for the ClientDelivery application. The flow is
identical to that of the CreditCheckClient application.
<<
use
>>
<<use>>
<<
use
>>
<<
use
>>
EJSLocalStatelessCCWSClientHome_f09aa5f3
<<
Java Class
>>
c
EJSStatelessCCWSClientHomeBean_f09aa5f3
<<
Java Class
>>
c
EJSLocalStatelessCCWSClient_f09aa5f3
<<
Java Class
>>
c
CCWSClientLocalHome
<<
Java Interface
>>
I
CCWSClientBean
<<Java Class>>
c
CreditCheckProxy
<<
Java Class
>>
c
CreditCheckInboundServiceLocator
<<
Java Class
>>
c
CCWSClientLocal
<<
Java Interface
>>
I
CreditCheckInboundPortBindingStub
<<
Java Class
>>
c
CreditCheckInboundService
<<
Java Interface
>>
I
<<
Java Interface
>>
CreditCheck
I
<<
use
>>
<<
use
>>
<<
use
>>
<<
use
>>
<<
use
>>
<<
use
>>
<<
use
>>
298 Patterns: Implementing Self-Service in an SOA Environment
Figure 10-5 Class diagram of the Web service requester and provider
Sequence diagram
Two Web service calls are performed in this part of the scenario. Both calls are
originated from the createCustomer() method in Processor.java. The first call is
issued to get a credit rating for the customer from the CreditCheck Web service.
The second call is to get an account number. The fact that the account number is
created by one of two account services depending on the type of delivery
account requested is transparent to the user and to the Processor application.
Routing to the proper account service is done in the ESB.
For simplicity we will treat each of these Web service invocations as separate
sequence diagrams. In reality, the Processor code performs several steps in
sequence to create a customer, the first is to get the credit rating, and the second
is to get the account number.
<<
use
>>
<<
use
>>
<<use>>
<<use>>
EJSLocalStatelessDeliveryWSClientHome_bc5368fa
<<
Java Class
>>
c
EJSStatelessDeliveryWSClientHomeBean_bc5368f
<<
Java Class
>>
c
EJSLocalStatelessDeliveryWSClient_bc5368f3
<<
Java Class
>>
c
DeliveryWSClientLocalHome
<<
Java Interface
>>
I
DeliveryWSClientBean
<<Java Class>>
c
HomeDeliveryProxy
<<Java Class>>
c
HomeDeliveryInboundServiceLocator
<<
Java Class
>>
c
DeliveryWSClientLocal
<<
Java Interface
>>
I
HomeDeliveryInboundPortBindingStub
<<Java Class>>
c
HomeDeliveryInboundService
<<Java Interface>>
I
<<
Java Interface
>>
HomeDelivery
I
<<
use
>>
<<use>>
<<
use
>>
<<
use
>>
<<
use
>>
<<use>>
<<
use
>>
Chapter 10. Web services scenario 299
Get credit rating
The sequence diagram in Figure 10-6 shows the interaction of classes and the
flow of control through the application as the credit rating for the customer is
obtained from the CreditCheck service.
Figure 10-6 Sequence diagram for the CreditCheck Web services requester and provider
1) The createCustomer() method in the Processor class is invoked.
1.1) createCustomer() invokes getCreditRating() method in the
ProcessorWebService class, passing the customer information
needed to obtain a credit rating.
1.1.1) getCreditRating() invokes the getCreditCheck() method to get the
creditCheck information of a particular customer.
1.1.1.1) getCreditCheck() does a JNDI lookup for the CCWSClient bean,
which acts as an interface to the Web service.
1.1.1.1.5) getCreditCheck() invokes the returnSimpleQuote() method of
CCWSClient bean, which in turn, invokes the returnSimpleQuote()
method of the proxy for the CreditCheck application. Control is then
passed to the CreditCheck application on the Web service provider.
The CreditCheck application returns the credit check reply message
back through the chain to CCWSClient bean.
1.1.1.1.7) The credit check rating gets passed back through the chain to the
requester side.
1: createCustomer
1.1: getCreditRating
1.1.1: getCreditCheck
1.1.1.1: <<create> InitialContext
1.1.1.1.1: lookup
<<return>>
1.1.1.1.2: lookup
1.1.1.1.3: create
<<return>>
1.1.1.1.5: getCreditCheck
<<return>>
1.1.1.1.4: create
1.1.1.1.6: returnSimpleQuote
<<return>>
1.1.1.1.7: returnSimpleQuote
<<return>>
1.1.1.1.8: getCreditRating
<<return>>
1.1.1.2: createCustomer
Processor:Processor
c
I
ccLocalHome:CCWSClientLocalHome
ProcessorWebService:ProcessorWebService
c
ic:InitialContext:
I
Property:CCWSClientLocal

Get Patterns: Implementing Self-Service in an SOA Environment 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.