ESB With WebSphere Service Registry and Repository
ESB With WebSphere Service Registry and Repository
Bhargav Perepa
Andrew Humphreys
Martin Keen
IBM® WebSphere® Service Registry and Repository provides the ability to strengthen an
enterprise service bus (ESB) that is built into IBM WebSphere ESB to make the ESB more
dynamic and adaptable.
Deploying an ESB and identifying core services creates the opportunity but does not fully
complete the promise of service-oriented architecture (SOA). Maturing ESB customers are
experiencing the following challenges:
Although the ESB has decoupled the service consumer from the service provider, the ESB
still has point-to-point links with the service. This connection makes for operational
challenges when service versions change or the service moves locations.
The properties that are used to configure and drive a mediation change over time.
Redeploying mediations can be expensive and risky when a property based on the needs
of both the business and IT must change quickly.
As the number of services grow and as new versions of the services are created, it is
increasingly difficult to decommission a service version or even determine who is using
that service.
Advertising the services that are available becomes a large challenge.
Many ESBs are not implemented truly enterprise wide. Instead, they are implemented as
business domain specific ESBs that are built to meet the requirements of a single
department or project. Sharing services between these domains in a consistent and
secure fashion becomes a challenge.
To address these issues and to capitalize on the opportunity created by the ESB, a service
registry is needed to complete the SOA software platform. An ESB and service registry
working together are core to building a dynamic SOA, enabling the ESBs to exploit policy
dynamically, and transforming the way that customers use ESBs for integration. The service
registry also provides the service visibility and governance needed to realize maximum return
on investment. With a service registry, you can understand the services that are running in
your environment, track service use, and increase service reuse.
This IBM Redpaper™ publication demonstrates how to integrate WebSphere ESB and
WebSphere Service Registry and Repository to realize the benefits of a more dynamic and
flexible ESB by building mediations that show integration points between the products.
Through a series of scenarios, this paper shows you how to build mediations that illustrate
how WebSphere ESB can interact with WebSphere Service Registry and Repository at run
time to make mediations more dynamic and adaptable. Using a service registry allows you to
change configuration data that is stored in WebSphere Service Registry and Repository to
change the behavior of the mediation without updating and redeploying mediation code.
Fictional company used in the use case scenarios: The examples that we show in this
paper use a fictional company called JKHL Enterprises (JKHLE).
Businesses want real-time visibility of service performance and availability and want to
measure and demonstrate return on investment by tracking service use. They want to
establish a catalog of existing services that provides visibility into capabilities and that helps
reduce redundancy. This catalog can help businesses understand the impact of changes to
existing services and enable them to control service consumers and providers through
policies.
WebSphere Service Registry and Repository provides service discovery features to help take
inventory of services that are deployed in runtime environments. On a scheduled basis,
The Governance Enablement Profile (GEP) of WebSphere Service Registry and Repository
gives a prescriptive approach to both service consumer and service provider governance. It
manages subscriptions, documents of understanding, and service level agreements between
the consumer and provider, enabling the ability to track who is using a given service.
WebSphere Service Registry and Repository also integrates with monitoring systems such as
IBM Tivoli® Composite Application Manager for SOA to provide real-time visibility into service
performance.
Also ESB development inherently involves invoking numerous endpoints. When endpoints are
not decoupled from mediation code, promotion to other development environments requires
significant changes to the ESB configuration.
Enabling dynamic and efficient access to services, policies and metadata information, allows
mediations to dynamically choose service providers and endpoints and to adapt quickly to the
status of critical services, greatly increasing the flexibility of the ESB.
Storing and defining some application and translation logic outside of the ESB means the
logic can be updated without needing to change and redeploy the mediations. Similarly,
storing and managing policies outside of the ESB means that you can define and manage the
policies separately from the mediations. The ESB can then query WebSphere Service
Registry and Repository at run time to determine the policies that are required for the service
and can then enforce them.
WebSphere Service Registry and Repository increases the agility of WebSphere ESB
through the Endpoint Lookup, SLA Check, and Policy Resolution mediation primitives.
These primitives are key to accelerating robust flexible mediations, which you can change
rapidly without redeployment of the mediation.
For a successful SOA, you need to create open, standardized services and reusable assets
that can be used by multiple lines of business, and you need to increase productivity by
reusing service assets through multiple service implementations. To achieve this level of
services, you need to store, catalog, and flexibly organize assets and services and enforce
guidelines to prevent uncoordinated or unapproved changes.
To perform this integration with security enabled on both servers, you need to import the
WebSphere Service Registry and Repository signer certificate into the WebSphere ESB trust
store.
Figure 1 shows that we imported signer certificate using the WebSphere ESB Integrated
Solutions Console. Note that we set the SSL configuration for outbound connection to
NodeDefaultSSLSettings.
You can click Test Connection to confirm that WebSphere ESB and WebSphere Service
Registry and Repository are integrated successfully. Figure 5 shows the connection
successful message.
The Endpoint Lookup mediation primitive can search for and retrieve endpoint information
related to SOAP/HTTP, SOAP/JMS, SCA, SCA MQ, MQ JMS, JMS, Generic JMS, HTTP,
manual MQ, and manual JMS protocol bindings.
The Endpoint Lookup primitive query can go beyond just looking for a particular port type.
Other attributes such as namespace and version are supported, as are custom properties
and classifications. The Endpoint Lookup primitive also specifies a match policy, which tells
WebSphere Service Registry and Repository how many matching endpoint URLs to return
and tells WebSphere ESB where those endpoint URLs should be stored in the SMO
message.
Additional materials: You can find the mediation flow that we used in this use case
scenario in the additional materials that accompany this paper in the
Endpoint\AccountCreationEndpointLookupMediationModule.zip project interchange file.
Mediation Module
Request Flow
Endpoint
XSLT
Lookup
Primitive
Primitive SOAP/
Integration
HTTP Eligibility
Test Response Flow
Import Service
Client
XSLT
Primitive
One endpoint
WebSphere
Service Registry
and Repository
Because the service consumer and service provider use different interfaces, we need a
transformation primitive. Figure 8 shows the XSLT mediation primitive that is used in the
request flow to perform this mapping. This primitive uses a Mapping file of
xslt/Request_Map_req1.map.
The response flow contains an XSLT mediation primitive to map the response message from
the service provider to the response message format expected by the service consumer.
Figure 11 shows the response flow.
The WSDL file: You can find this WSDL file in the WebSphere Integration Developer
workspace where you imported the mediation flow. You can find it at:
[workspace directory]\EligibilityGEN_Service\WebContent\WEB-INF\wsdl\
EligibilityGEN_ServiceHttpPort.wsdl
The results from the Integration Test Client indicate that the EligibilityGEN service was
invoked (Figure 15), and the Server Logs shows a response message from the EligibilityGEN
service indicating that the account is eligible (Figure 16).
Figure 17 shows the results of the SMO message after the Endpoint Lookup mediation is
invoked. The \headers\SMOHeader\Target\address element of the SMO message is
populated with the endpoint URL of the EligibilityGEN service, retrieved from WebSphere
Service Registry and Repository.
Figure 17 Endpoint URL retrieved from WebSphere Service Registry and Repository
This test shows that dynamic endpoint lookup is functioning correctly. If the endpoint URL of
the EligibilityGEN service changes in future, then you need to update only the
EligibilityGEN_ServiceHttpPort.wsdl file with the new URL and load it into WebSphere
Service Registry and Repository. You do not need to change the WebSphere ESB mediation.
Additional materials: You can find the mediation flow that we used in this use case
scenario in the additional materials that accompany this paper in the
Endpoint\AccountCreationCustomEndpointLookupMediationModule.zip project
interchange file.
Mediation Module
Mediation Module
Request Flow
XSLT
Endpoint
Custom
Lookup
XSLT SOAP/
Integration
HTTP Eligibility
Test Response Flow
XSLT Import Service
Client
Fail
all endpoints
WebSphere
Service Registry
and Repository
Example 1 shows the Custom mediation primitive logic. This Custom primitive performs the
following steps:
1. Compares the CustomerSubType custom property from all services that are returned from
WebSphere Service Registry and Repository with the first name specified in the body of
the SMO message.
2. If the CustomerSubType and first name match, the headers/SMOHeader/Target element of
the SMO message is updated with the matching service endpoint URL. This endpoint URL
is used for dynamic endpoint lookup. The regular output terminal of the Custom primitive is
fired.
3. If no first names match the CustomerSubType custom property in WebSphere Service
Registry and Repository, then a failure message is written, and a second output terminal
of the Custom primitive is fired.
if(smo.get("/context/primitiveContext")!=null){
java.util.List services = smo.getList("/context/primitiveContext/EndpointLookupContext");
System.out.println("Select Endpoint:: Endpoint count: " + services.size());
/* create an iterator to loop through the service data */
java.util.Iterator serviceIterator = services.iterator();
com.ibm.websphere.sibx.smobo.ServiceMessageObjectFactory.eINSTANCE.createTargetAddressType();
if (!finished) {
System.out.println("Select Endpoint:: No valid endpoint found for customer type: " +
requiredPropValue);
out1.fire(smo);
}
else {
out.fire(smo);
}
Figure 20 shows the completed request flow. Note that if the Endpoint Lookup or Custom
primitives do not find a matching service, the NoMatchResponse XSLT primitive is navigated
to, and a response is sent back immediately to the service consumer (no service provider is
invoked).
Figure 21 shows the completed response flow. An XSLT primitive transforms the response
message into a format expected by the service consumer. Note that if an unmodelled fault is
received by the mediation, the Fail mediation primitive is navigated and the service consumer
receives no response.
Importing the WSDL files: You can find these WSDL files in the WebSphere Integration
Developer workspace where you imported the mediation flow. Import the following files,
which are in the WebSphere Integration Developer workspace directory:
\EligibilityCIVService\WebContent\WEB-INF\wsdl\EligibilityServiceSchema.xsd
\EligibilityCIVService\WebContent\WEB-INF\wsdl\EligibilityService.wsdl
\EligibilityCIVService\WebContent\WEB-INF\wsdl\EligibilityCIVService.wsdl
\EligibilityDoDService\WebContent\WEB-INF\wsdl\EligibilityDoDService.wsdl
\EligibilityGenericService\WebContent\WEB-INF\wsdl\EligibilityGenericService.wsdl
Figure 22 Loading WSDL documents into WebSphere Service Registry and Repository
The Server Logs views (Figure 25) shows that three endpoints were returned from
WebSphere Service Registry and Repository by the Endpoint Lookup mediation primitive.
The Custom mediation primitive found that one of the endpoints contained a
CustomerSubType property that matched the value JKHLE-CIV. Therefore, this endpoint URL
(EligibilityCIVService) is used as the service provider.
Figure 25 Server Logs view showing the EligibilityCIVService service provider is selected
If you enter any other firstName, for example ABCDE, none of the endpoint URLs that are
returned by WebSphere Service Registry and Repository are used, and no service provider is
invoked (Figure 26).
Service gateway
Additional materials: You can find the mediation flow that we used in this use case
scenario in the additional materials that accompany this paper in the
ServiceGateway\AccountCreationPolicyGateway.zip project interchange file.
A service gateway is a common ESB pattern where a single endpoint is exposed to clients.
This single endpoint acts as a proxy to a variety of different services that are called by the
ESB but that are not exposed directly to the service consumers. In this pattern, all service
consumers use only the endpoint address that is exposed by the gateway. The gateway then
routes the request to the appropriate service implementation. The gateway can also add
additional value by including transformations, routing, and common processing that needs to
be applied to all service requests, for example by carrying out common logging requirements.
You can use the Gateway Endpoint Lookup mediation primitive in WebSphere ESB to
implement a service gateway that routes web service requests to the required service based
on the request’s SOAPAction or the WS-Addressing Action field. The Gateway Endpoint
Lookup mediation primitive uses the action field value to retrieve the endpoint for the required
service from WebSphere Service Registry and Repository.
Mediation Module
EligibilityGEN_ EligibilityGEN_
Request Flow
Service Service
Consumer Gateway Consumer
Policy
Endpoint Log
Resolution
Lookup
SOAP/ SOAP/
EligibilityCIV_ HTTP EligibilityCIV_
Service Response Flow HTTP Service
Export Import
Consumer Consumer
Log
EligibilityDoD_ EligibilityDoD_
Service Service
Consumer Consumer
Mediation Policy
Enabled
Root Service Gateway
WSRR
WSRR
The service gateway receives requests for multiple services (in this example general or
civilian or defense account creation requests) and based on the SOAPAction setting in the
request, routes it to appropriate service provider.
Figure 30 shows the completed request flow. Note that it contains no primitives that need
customizing.
Additional materials: You can find the WSDL files and supporting XSDs that we used in
this use case scenario in the additional materials that accompany this paper in the
ServiceGateway/WSDLs directory. You might need to update the endpoint addresses to
match where you have deployed the services in your environment.
Figure 31 shows that the service definitions for the services that the gateway invokes are
loaded into WebSphere Service Registry and Repository. These service definition include
endpoint URLs.
You need to export the SCA mediation module from WebSphere Integration Developer and
load it as an SCA integration module into WebSphere Service Registry and Repository.
Figure 32 shows the SCA mediation module loaded into WebSphere Service Registry and
Repository.
Each SCA import is configured to invoke the service gateway rather than directly invoke the
service. Figure 34 shows the import binding that is configured to point to the service gateway
address, meaning that the service gateway mediation is invoked by the import.
Figure 37 shows the server console log for the unit test case run that shows the Service
Gateway receiving the request, retrieving the endpoint, and invoking the correct service,
If we repeat the test for the EligibilityDoD_Service SCA Import and EligibilityCIV_Service
SCA import, respectively, the appropriate service is also invoked by the Service Gateway
mediation.
Dynamic properties
Additional materials: You can find the mediation flow that we used in this use case
scenario in the additional materials that accompany this paper in the
Policy\AccountCreationModule.zip project interchange file.
Dynamic properties give you the power to control the properties of mediation primitives on a
message-by-message basis. Using dynamic properties in WebSphere ESB can simplify a
mediation flow so that it is controlled dynamically. By using the Policy Resolution mediation
primitive and promoted properties, you can avoid complexity in a mediation flows where
branching and multiple mediation primitives are used.
Mediation Module
Transform Request Flow
Message Message
Transform
Filter Log Filter
Transform SOAP/
Integration HTTP EligibilityGEN
Test Response Flow Service
Import
Client
Transform Log
The request flow of this mediation primitive should behave differently, depending on the
content of the message sent by the service consumer:
If the customerNumber sent by the service consumer is equal to 999, the message must
be logged in the request flow. To achieve this, a Message Filter mediation primitive checks
the value of the customerNumber property, and if that value equals 999, the Message
Logger mediation primitive is invoked.
The address element of the input message must be formatted depending on the country
the request is intended for. There are three XSL Transformation mediation primitives in the
request flow, to transform U.K., German, and U.S. addresses. A second Mediation Filter
primitive examines the value of the country code and invokes the relevant XSLT
Transformation primitive.
This request mediation flow contains six mediation primitives to perform these tasks. As the
complexity of the mediation grows (more country addresses need to be supported for
example), the number of mediation primitives needed also grows.
By using dynamic properties, this request mediation flow can be simplified to use just three
mediation primitives (Figure 39).
Mediation Module
Request Flow
Policy
Log Transform
Resolution
SOAP/
Integration HTTP EligibilityGEN
Test Response Flow Service
Import
Client
Transform Log
Enabled Mapping
File
WebSphere
Service Registry
and Repository Enabled
For example, the assertion might determine that the Enabled property of the Message Logger
needs to be set to false (meaning no message is logged) and the Mapping file of the XSLT
Transformation mediation primitive needs to be set to RequestTransformation_UK (to
transform a U.K. address).
Figure 43 shows that the Mapping file property of the XSL Transformation primitive is
promoted.
Figure 46 SCA integration module loaded into WebSphere Service Registry and Repository
When an SCA integration module is loaded into WebSphere Service Registry and Repository,
a default policy is defined (see Figure 47). Note that there are assertions for
Log_Request.enabled, Transform_Address.XSLTransform, and Log_Response.enabled. The
value for these assertions is taken from the default value that is assigned to the mediation
primitive properties in WebSphere Integration Developer.
By default, this policy is not attached to an SCA mediation module. If you want to use the
default policy, you must attach it manually. We do not attach the default policy in this scenario.
In Business Space, you can define additional policies. For our scenario, we created a new
space in Business Space containing the Module Browser and Mediation Policy Administration
widgets (Figure 48).
We created three policy attachments with assertions and defined a gate condition for each.
The gate condition determines whether the policy attachment is applicable.
Figure 50 shows the policy attachment AddressTransformation_UK, which sets the Mapping
file property of the XSL Transformation mediation primitive to xslt/RequestTransform_UK.xsl
with the gate condition that the country equals a value of UK.
If the Policy Resolution mediation primitive queries WebSphere Service Registry and
Repository for policies and no matching assertion is found for a given promoted property, the
value for a promoted property specified in the Integrated Solutions Console of WebSphere
ESB is used instead. If that country does not equal DE or UK, the default value of
xslt/RequestTransform_USA.xsl is applied to the Mapping file property (see Figure 52).
Figure 54 Results indicating enabled Message Loggers and use of the German mapping file
Figure 55 Results indicating use of the U.K. mapping file (and no Message Logger primitives)
Specifying a customerNumber of 100 and a country of USA, no policies are returned. The
values specified in the Integrated Solutions Console are used instead. Therefore, the U.S.
mapping file is used (as shown in Figure 56).
WebSphere Service Registry and Repository stores consumer and provider service
representations. An SLA can be associated with a consumer service representation in
WebSphere Service Registry and Repository so that contract terms can be specified to a
provider service definition contained in the same WebSphere Service Registry and
Repository.
WebSphere ESB provides the SLA Check mediation primitive to check whether a particular
service requester has an SLA with a particular service provider. Additionally, the SLA Check
mediation primitive can using additional metadata that is stored in the WebSphere Service
Registry and Repository SLA to facilitate consumer and provider interactions.
Mediation Module
Request Flow
Event Stop
Emitter primitive
CEI Server
WebSphere
Service Registry
and Repository
Additional materials: We provide the mediation flow that we used in this use case
scenario in the additional materials that accompany this paper in the
SLA\AccountCreationSLAModule.zip project interchange file.
Figure 59 shows the Event Emitter mediation primitive properties, which logs an event that is
labeled AccountCreationModule_AccountCreationSLAModule_SLACheckReject with the body
of the SMO message to a CEI server. This primitive is executed when the SLA check results
in a rejection.
Both the request and response flows contain an XSLT primitive to transform the body of the
message sent between the service consumer and service provider.
To provide effective governance, ownership and accountability, you need to identify clearly
who is responsible for services, such as the Account Creation service and
EligibilityGEN_Service service. For our fictional JKHLE parent organization, we defined two
child organizations named Common Services and Commercial.
For this scenario, we loaded metadata artifacts into WebSphere Service Registry and
Repository to populate the Account Creation service consumer and EligibilityGEN_Service
service provider. We established metadata relationships between the consumer and provider
services and performed life cycle state transitions so that the EligibilityGEN_Service service
provider is online.
Figure 66 shows that the EligibilityGEN_Service service provider was invoked. Therefore, the
SLA Check primitive accepted the request.
Figure 66 SLA Check primitive accepts the request and the service provider is invoked
Figure 67 SLA Check primitive rejects the request and the Event Emitter primitive is invoked
Additional material
You can download the additional material from the Internet as we describe in this section. The
additional material that is associated with this paper is available in softcopy on the Internet
from the IBM Redbooks® Web server. Point your Web browser at:
ftp://www.redbooks.ibm.com/redbooks/REDP4686
Select Additional materials, and open the directory that corresponds with the IBM Redpaper
form number, REDP4686.
References
For more information, refer to the following resources:
Building WebSphere Enterprise Service Bus V7 Solutions IBM Redbooks Publications
Workshop (course code ZTS82 and VTS82)
http://www.redbooks.ibm.com/workshops/GR2779
What's new in WebSphere Enterprise Service Bus V7
http://www.ibm.com/developerworks/websphere/library/techarticles/1005_jackson/1
005_jackson.html
Andrew Humphreys is a Consulting IT Specialist at the IBM Hursley Laboratory in the U.K.
He is a Chartered Engineer and holds a Masters degree in Information Systems from The
University of Huddersfield and bachelor’s degree in Economics from City University, London.
He has extensive experience in architecting ESB style solutions working with customers in a
variety of industries using a range of IBM and other technologies.
Martin Keen is a Consulting IT Specialist at the ITSO, Raleigh Center. He writes extensively
about WebSphere products and service-oriented architecture (SOA). He also teaches IBM
classes worldwide about WebSphere, SOA, and ESB. Before joining the ITSO, Martin worked
in the EMEA WebSphere Lab Services team in Hursley, U.K. Martin holds a bachelor’s
degree in Computer Studies from Southampton Institute of Higher Education.
This information was developed for products and services offered in the U.S.A.
IBM may not offer the products, services, or features discussed in this document in other countries. Consult
your local IBM representative for information on the products and services currently available in your area. Any
reference to an IBM product, program, or service is not intended to state or imply that only that IBM product,
program, or service may be used. Any functionally equivalent product, program, or service that does not
infringe any IBM intellectual property right may be used instead. However, it is the user's responsibility to
evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this document. The
furnishing of this document does not give you any license to these patents. You can send license inquiries, in
writing, to:
IBM Director of Licensing, IBM Corporation, North Castle Drive, Armonk, NY 10504-1785 U.S.A.
The following paragraph does not apply to the United Kingdom or any other country where such
provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION
PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF NON-INFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of
express or implied warranties in certain transactions, therefore, this statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically made
to the information herein; these changes will be incorporated in new editions of the publication. IBM may make
improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time
without notice.
Any references in this information to non-IBM Web sites are provided for convenience only and do not in any
manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of the
materials for this IBM product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it believes appropriate without incurring
any obligation to you.
Information concerning non-IBM products was obtained from the suppliers of those products, their published
announcements or other publicly available sources. IBM has not tested those products and cannot confirm the
accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the
capabilities of non-IBM products should be addressed to the suppliers of those products.
This information contains examples of data and reports used in daily business operations. To illustrate them
as completely as possible, the examples include the names of individuals, companies, brands, and products.
All of these names are fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs in
any form without payment to IBM, for the purposes of developing, using, marketing or distributing application
programs conforming to the application programming interface for the operating platform for which the sample
programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore,
cannot guarantee or imply reliability, serviceability, or function of these programs.
The following terms are trademarks of the International Business Machines Corporation in the United States,
other countries, or both:
Other company, product, or service names may be trademarks or service marks of others.