Skip to main content

Make composite business services adaptable with points of variability, Part 2: Using dynamic service mediation in WebSphere Business Services Fabric

Indrajit Poddar (ipoddar@us.ibm.com), Advisory Software Engineer, IBM, Software Group
Indrajit Poddar's photo
Indrajit Poddar (IP) is a member of the Strategy, Technology, Architecture and Incubation (STAI) team in the IBM Software Group, where he is architecting a number of PoCs for building SOA composite business services using IBM SOA Foundation products.
Duo Wei (David) Sun (sunduow@cn.ibm.com), Software Engineer, IBM
Photo of DuoWei (David) Sun
DuoWei (David) Sun is a staff software engineer in China Software Development Lab (CSDL). He is currently working in the SOA development area.
Germán Goldszmidt (gsg@us.ibm.com), Distinguished Engineer, IBM, Software Group
author photo
Dr. Germán Goldszmidt is a Distinguished Engineer working in the IBM Software Group, with focus on architecture of an integrated platform to deliver, customize, and deploy SOA composite business services. Previously, he was a researcher at the IBM T.J. Watson Research Center, and he led the design and implementation of several technologies, including Océano, the first prototype autonomic computing eUtility, and Network Dispatcher, the load balancer component of WebSphere products.
Ying Chun Guo (guoyingc@cn.ibm.com), Software Engineer, IBM, Software Group
author photo
Ying Chun Guo works as a software engineer at the China Technology Institute, China Software Development Laboratory. She is currently working on composite business services (CBS) and Service-Oriented Architecture (SOA).

Summary:  Explore options for building points of variability (POV) in Service-Oriented Architecture (SOA) composite business services in this series. A common requirement for POVs is to be able to easily change the behavior of a service, despite differences in client organization, processes, technology, or business relationships. IBM® WebSphere® Business Services Fabric (WBSF) lets you adapt service behavior based on the content of a service request, policies, service definition, and semantics. Read this article to learn how to bind, at runtime, a service invocation in a Business Process Execution Language (BPEL) process to one of several related endpoints by using ontology extensions and the WBSF Dynamic Service Assembler. A credit card scenario shows the implementation step by step. You walk through possible issues and explore the advantage of using WBSF compared with other Service Component Architecture (SCA) components (business rules, selectors, and mediation modules).

View more content in this series

Date:  08 May 2007
Level:  Intermediate
Activity:  2557 views

Introduction

WebSphere Business Services Fabric (WBSF) acts as a mediator for all service invocations for service interfaces that it has registered. The mediation is based on metadata associated with service endpoints, policies registered in WBSF, and contextual and content information in the service request. The types of metadata that can be registered in WBSF are defined with the help of an ontology.

In this article, you extend the core WBSF ontology to introduce a new assertion based on the credit score of a credit card applicant. We'll use this assertion in the WBSF Service Assembler to select (at runtime) one of several endpoints for a business service in a credit card approval BPEL process executing in WebSphere Process Server.


Scenario: Credit card application process

Figure 1 shows a use case for a credit card application process in the proof-of-concept Jivaro bank composite application, introduced in the article "Building SOA composite business services" (see Resources). The credit card application (CCA) process includes two subprocesses (CCA1 and CCA2) for application approval. The subprocess for high credit score applicants (CCA1) has only one level of approval by a bank employee. The subprocess for low credit score applicants has two levels: by a bank employee and another by a manager. The cut-off limit for a high credit score is determined according to bank policies. The CCA process chooses one of these two subprocesses (CCA1 or CCA2) at runtime based on the credit score of the applicant. The CCA scenario demonstrates how WBSF can provide dynamic and configurable service mediation.


Figure 1. Credit card approval process with two alternative sub-processes
Secnario

Implementation

To implement the use case, you will:


Preparing BPEL and Web services

To start implementing the use case in Figure 1, you will create a composite business service with three BPEL processes providing these services:

CreditCardApproval
Retrieve the credit score of the credit card applicant, and invoke the credit card approval process.
HighCreditScoreCreditCardApproval
Create a human task for a bank employee to review and approve the credit card application.
LowCreditScoreCreditCardApproval
Create two human tasks: one for a bank employee and another for a bank manager to review and approve the credit card application.

The HighCreditScoreCreditCardApproval and the LowCreditScoreCreditCardApproval services will both implement the same Service Component Architecture (SCA) Web service interface: ApprovalProcessInterface, as shown in Figure 2.


Figure 2. ApprovalProcessInterface
ApprovalProcessInterface

Extending the WBSF ontology

WBSF uses OWL (Web Ontology Language), to represent different types of service-related metadata and their relationships. For the use case in Figure 1, the requirements are:

  • If the credit score of the applicant is more than 750 and less than 800, invoke the HighCreditScoreCreditCardApproval process from the parent CreditCardApproval process.
  • If the credit score of the applicant is less than 750 and more than 0, invoke the LowCreditScoreCreditCardApproval process from the parent CreditCardApproval process.

To implement the above requirements, we will create a WBSF content-based assertion: CreditScoreAssertion with two integer type properties called MinCreditScore and MaxCreditScore.

Create an OWL file

To create an OWL file, you'll use an open source tool called Protégé. To create a new OWL/RDF files project in Protégé, use http://www.webifysolutions.com/2006/11/jivaro2_schm as the ontology URI, as shown in Figure 3. The URI name should match the namespace of the ontology project to be created in WBSF in a later step.


Figure 3. Enter the Jivaro ontology URI in Protégé
Enter the Jivaro ontology URI

In the Metadata tab, click Import Ontology, as shown in the red box in Figure 4, to import the extension stubs. Import the WBSF Core stub and assertion stub. These files are in the WBSF FoundationPack installation directory. For example:
D:\IBM\WebSphere\Fabric\6.0\FoundationPack\SDKs\fabric-sdk-6.0.0\owl
C:\IBM\WebSphere\Fabric\6.0\ToolPack\Plugins\SDKs\fabric-sdk-6.0.0\owl


Figure 4. Import WBSF extension stubs
Import the WBSF extension stubs

In the OWL classes tab, click Create subclass, in the red box in Figure 5, to create a subclass CreditScoreAssertion under ContentBasedAssertion. Click Create new annotation value, in the blue box in Figure 5, to add a new annotation core:assertionType to subclass CreditScoreAssertion. Set the value of the annotation core:assertionType to Endpoint Selection.


Figure 5. Create a subclass under ContentBasedAssertion
create assertion

In the Properties tab, click Create datatype property, in the red box in Figure 6, to create the datatype property MinCreditScore. Add two annotations, core:assertionPropertyComparator and core:controlWidget, to property MinCreditScore. Set the value of the annotations to LessThanComparator and integer, respectively. In Domain, click Specialism Domain, in the blue box in Figure 6, to add the subclass CreditScoreAssertion. Select int for the range, and check the Functional box.


Figure 6. Create datatype property MinCreditScore
Create MinCreditScore

Add a similar datatype property, MaxCreditScore, similar to MinCreditScore. Repeat the preceding step with the value of the annotation core:assertionPropertyComparator set to GreaterThanComparator.


Figure 7. Create datatype property MaxCreditScore
Create MaxCreditScore

Save this project as an OWL file, as in Figure 8.


Figure 8. Save the OWL file
Save OWL file

Create an ontology extension project in WBSF

In this step, you create an Ontology Extension project in WBSF named Jivaro2 Ontology and a new schema namespace for this project, http://www.webifysolutions.com/2006/11/jivaro2_schm# .

The project's namespace URI must match the URI of the OWL file created in Create an OWL file.

  1. Start the WBSF runtime, which is installed on top of WebSphere Process Server.
  2. Log in to the WBSF Business Services Catalog as an administrator, for example http://localhost:9080/fabric.
  3. Click My Services > Governance Manager > Configure Projects, and click Create a Project.
  4. In the Create a Project form, as shown in Figure 9, enter a project name, such as Jivaro2 Ontology, select Ontology Extension for the Project Type, and select a Team Organization.

    We'll use System for demonstration purposes. In practice, it is recommended that different team organizations be created for different development teams and the appropriate team organization be selected.

    Click Create Project.



    Figure 9.Create an ontology extension project in WBSF Business Services Repository
    Ontology Extension Project

  5. Click My Services > Governance Manager > Configure Namespaces, and click Create a Namespace.
  6. In the Create a Namespace form, as shown in Figure 10, use:
    • Display Name: Jivaro2 Schema
    • Namespace Type: Schema
    • Namespace Prefix: jivaro2
    • Namespace URI: http://www.webifysolutions.com/2006/11/jivaro2_schm#
    • Owner Project: Jivaro2 Ontology
    Click Create Namespace.

    Figure 10.Create a new schema namespace in the WBSF Business Services Repository
    New Schema Namespace

Create a WBSF Ontology Content Pack file

WBSF uses Ontology Content Pack (OCP) files to specify a project's ontology. In order to extend the WBSF core ontology, we need to export an empty OCP file from the WBSF Business Services Repository (BSR). The OCP file is a zip file containing OWL files and a special manifest file named content-pack.xml.

The OWL file Jivaro2Schema.owl, created in Figure 8, should be inserted into this empty OCP file, and the name of the OWL file specified in the manifest file should be changed to Jivaro2Schema.owl. The updated OCP file should be imported back into the WBSF BSR.

  1. Log in to the WBSF Business Services Catalog as an administrator.
  2. Click My Services > Governance Manager > Import/Export, and select the Export by Project tab, as shown in Figure 11. Select the project Jivaro2 Ontology and the namespace Jivaro2 Schema, and click Export To File. A file download dialog is promoted.

    Figure 11. Export an empty OCP file for Jivaro2 Ontology project from WBSF Business Services Repository
    Export OCP file

  3. Save this OCP file to your hard disk. Open the file using a tool such as WinZip. Replace the empty OWL file with the OWL file created in Create an ontology extension project in WBSF, using exactly the same file name.
  4. In the Import tab, as shown in Figure 12, click Browse to file this OCP file to import. Click Import File.

    Figure 12. Import updated OCP file for Jivaro2 Ontology project into BSR
    Import OCP file

Assembling a composite business service in WBSF

WBSF provides an environment to assemble composite business services (CBSs). The steps, discussed in this section, are:

  1. Create a project and a runtime environment in the WBSF BSR.
  2. Create a project with Web services, endpoints, and metadata in the WBSF Composition Studio.
  3. Simulate the policies.
  4. Submit the changes to the WBSF Governance Manager.
  5. Publish the metadata to the BSR.

Create a CBS project in WebSphere Business Services Fabric BSR

At the start of a development project, a WBSF administrator creates a new project of type SOBA, assigns a team to it, and allocates CBS instance namespaces for that project. The steps are similar to the steps in Create an ontology extension project in WBSF, except that we use a project type of SOBA, as shown in Figure 13.


Figure 13. Create new project in WBSF Business Services Repository
Create a SOBA project in BSR

As shown in Figure 14, use an instance namespace of http://www.webifysolutions.com/2006/11/jivaro2-inst# .


Figure 14. Create an instance namespace for new project
Create an instance namespace

Configure the runtime environment

WBSF uses named environments to store service endpoint metadata at runtime. The environment name ties the runtime storage to a development project in WBSF Composition Studio.

  1. Login to the WBSF Business Services Catalog as an administrator.
  2. Click My Services > Governance Manager > Configure Environments, then click Create an Environment.
  3. As shown in Figure 15, in the Configure Environments form enter the environment name Jivaro2 Banking Runtime and the description. Click Create Environment.

    Figure 15. Create an environment in WBSF BSR
    Create an environment

  4. Click My Services > Governance Manager > Configure Catalog, check Jivaro2 Banking Runtime environment, and click Save Environments, as in Figure 16.

    Figure 16. Configure the Repository in WBSF
    Configure Catalog

Create a project in WBSF Composition Studio

In this step, you'll create a project in WBSF Composition Studio for creating services and endpoint metadata.

  1. Launch Composition Studio and set the Catalog configurations in the Preferences dialog, as shown in Figure 17.

    Figure 17. Repository Configuration in WBSF Composition Studio
    Repository Configuration

  2. Switch to the SOBA Resource perspective. Right-click in the Resource Explorer view, and select New > SOBA Project.
  3. Click Next, enter a Project name of Jivaro2, as shown in Figure 18, and click Next.

    Figure 18. Create project in WBSF Composition Studio
    Create a SOBA project

  4. In the second page of this wizard, click Replicate to replicate the local copy of the Business Services Catalog in your workspace. Click Next.
  5. In the third page, select the Fabric Project Jivaro2, created in the first step of assembly, and click Finish.

Create Web services in WBSF Composition Studio

In this step, you create a WBSF Web service corresponding to the common ApprovalProcessInterface service described in Preparing BPEL and Web services.

  1. Right-click Jivaro2 in the Resource Explore view, and select New > Web Service.
  2. Click Next. As shown in Figure 19, select Jivaro2 as the Project and Jivaro2 Instance as the Namespace. Make sure Create Web Service Model from a WSDL is selected, and click Next. (Download sample code now.)

    Figure 19. Create Web Service entity from WSDL in WBSF Composition Studio
    Create a Web Service

  3. Use Browse to select the Web Services Description Language (WSDL) file of CreditCardApprovalProcess service and click Next, as shown in Figure 20. ( Download the WSDL file now.)

    Figure 20. Set location of WSDL for WBSF Web service in local file system
    Import WSDL

  4. Click Add All to select port types and operations, as in Figure 21, and click Next.
  5. Click Finish, and a Web service named ApprovalProcessInterface is created.

    Figure 21. Select PortTypes for CreditCardApproveProcess Web service
    Select PortTypes

Create endpoints and metadata

In this step you'll create two endpoints, HighCreditScoreApprovalEndpoint and LowCreditScoreApprovalEndpoint for services 2 and 3, described in Preparing BPEL and Web services. For each endpoint you add a CreditScoreAssertion that was created in Extending the WBSF ontology. We'll set the MinCreditScore and MaxCreditScore properties of the assertion for the HighCreditScoreApprovalEndpoint as 750 and 800, respectively.

For the LowCreditScoreApprovalEndpoint, we will set these properties to 0 and 750, respectively. This will meet the requirements described in Extending the WBSF ontology.

  1. Right-click Jivaro2 in the Resource Explore view, and select New > Endpoint.
  2. Click Next, select Jivaro2 as the project, set the name to HighCreditScoreApprovalEndpoint, select Jivaro2 Instance as the namespace, and select HTTP as the Address. Click Next.
  3. Enter the URL of HighCreditScoreCreditCardApproval process endpoint, for example http://saswsserver:9080/HighCreditScoreCCApprovalWeb/sca/ApprovalProcessExport, and click Finish. An endpoint HighCreditScoreApprovalEndpoint will be created.
  4. In the Assertions tab, click Interoperability. Select CreditScoreAssertion and click Add. As shown in Figure 22, set the two properties MinCreditScore and MaxCreditScore to 750 and 800.

    Figure 22. Add CreditScoreAssertion, MinCreditScore, MaxCreditScore properties for HighCreditScoreApprovalEndpoint
    Add the CreditScoreAssertion

  5. In the Web Services tab, click Add Existing to set the Web service ApprovalProcessInterface as an associated Web service, as in Figure 23.

    Figure 23. Associate the ApprovalProcessInterface Web service with HighCreditScoreApprovalEndpoint
    Associate the web service

  6. In the Environments tab, as shown in Figure 24, click Add Existing to set the environment Jivaro2 Banking Runtime as an associated environment.

    Figure 24. Associate environment Jivaro2 Runtime with HighCreditScoreApprovalEndpoint
    Associated the environment

  7. Save this endpoint definition.
  8. Repeat the preceding steps to create another endpoint, LowCreditScoreApprovalEndpoint. Set the two properties MinCreditScore and MaxCreditScore of CreditScoreAssertion to 0 and 750, as shown in Figure 25.

    Figure 25. Add CreditScoreAssertion, MinCreditScore, and MaxCreditScore properties for LowCreditScoreApprovalEndpoint
    Add the CreditScoreAssertion

Simulate policies

In this step, you use the Policy Simulator in the WBSF Composition Studio to test the policies. As shown in Figure 26, when we set the properties MinCreditScore and MaxCreditScore to 600, the LowCreditScoreApprovalEndPoint is selected.

  1. Switch to SOBA Assembly Perspective, right click Jivaro2 in the SOBA Explorer view, and select New > Application Suite. Enter Test Suite as the name of the application suite, and click Finish. An application suite is created.
  2. Right-click the created application suite and select New > Application. Enter Test Application as the name of the application. Browse to Test Suite, and select it as the Application Suite. Click Finish, and an application is created.
  3. Switch to the SOBA Resource Perspective. Right-click Jivaro2 in the Resource Explore view, and select New > Business Service.
  4. Select Visibility Service as Business Service Model Type, and click Next.
  5. Enter CreditCardApprvalService as the name of the service, browse to Test Application, select it as the application, add WebServiceChannel as a channel, and add Customer as a role type. Click Finish to create a business service.
  6. In the Channels tab of the business service CreditCardApprvalService, select the WebServiceChannel and add ApprovalProcessInterface created in Create a WBSF Ontology Content Pack file as a Web service. Save this business service.
  7. Click Run SOBA Policy Simulator for a new SOBA Simulator.
  8. Under Required Criteria, click Browse to select the business service CreditCardApprvalService.
  9. Under Optional Criteria, click Browse beside Content to set the value of properties MaxCreditScore and MinCreditScore to 600.
  10. Click Run Simulation, as shown here.

    Figure 26. Policy Simulator in WBSF showing result of a simulation for CreditScoreAssertion
    Policy Simulator

Submit the metadata

Now it's time to submit the services and metadata to the WBSF Governance Manager for approval.

  1. In the Catalog Changes view, right-click Jivaro2 and select Submit Changelist.
  2. Click Next, select the Jivaro2 project, and click Next.
  3. Use Add All, as shown in Figure 27, to select all the changes, and click Finish.

    Figure 27. Submit Changes to the WBSF Business Services Repository from the Composition Studio
    Submit changes

Publish the metadata

In this step, the administrator will review the business service metadata, approve them, and publish them to the repository.

  1. Log in to the WBSF Business Services Catalog as an administrator.
  2. Click My Services > Governance Manager > Manage Changes, and click Search.
  3. The changes submitted from the Composition Studio can be seen in the list. Click the Short Description field, as shown in Figure 28.

    Figure 28. Search change lists in WBSF Governance Manager
    change lists

  4. Click Approve to approve.
  5. Click Publish to publish it to the repository. Now the changes are available.

Invoking the services through WBSF Dynamic Assembler

The WBSF Dynamic Assembler applies assertions on properties included in the context element of the SOAP header. Listing 1 shows a sample SOAP header containing the MaxCreditScore and MinCreditScore properties. We define the WBSF context element explicitly in the Web Services Description Language (WSDL) for the ApprovalProcessInterface using the technique described in the article "Tip: Implement explicit and implicit headers" (see Resources). We use service data object (SDO) application programming interfaces (APIs) in a Java™ snippet within the BPEL process to add the MaxCreditScore and MinCreditScore property values to the context element. (Download sample code now.)


Listing 1. Sample SOAP header with WBSF context information for CreditScoreAssertion
<soapenv:Header>
   <Context xmlns="http://www.webifysolutions.com/2006/01/prism-context" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xmlns:xs="http://www.w3.org/2001/XMLSchema">
	  <context-identifier 
		xmlns="http://docs.oasis-open.org/wscaf/2005/10/wsctx">prism:begin
	  </context-identifier> 
		<property name="http://www.webifysolutions.com/context/interface">
		  http://CreditScoreCCApproval/ApprovalProcessInterface#ApprovalProcessInterface
	  </property> 
	  <property name="http://www.webifysolutions.com/2006/11/jivaro2_schm#MaxCreditScore">600
	  </property> 
	  <property name="http://www.webifysolutions.com/2006/11/jivaro2_schm#MinCreditScore">600
	  </property> 
   </Context>
</soapenv:Header>
			

Define explicit SOAP header

We explicitly define the SOAP header context element in the ApprovalProcessInterface in WebSphere Integration Developer, as shown in Figure 29.


Figure 29. Explicit SOAP header in the ApprovalProcessInterface WSDL
Explicit SOAP header

You'll then update the message and binding elements of the WSDL, as follows.

  1. Launch Integration Developer, and open the SCA module that contains a BPEL.
  2. Import four XML schema definition files into this SCA project.
  3. Open the WSDL file with XML Source Page Editor.
  4. Import prism-context-1.0.xsd to the schema part of WSDL, as shown in Listing 2.

    Listing 2. Import prism-context-1.0.xsd to ApprovalProcessInterface WSDL schema definition
    			<xsd:schema
    	targetNamespace="http://CreditScoreCCApproval/ApprovalProcessInterface" ...>
    	<xsd:importnamespace="http://www.webifysolutions.com/2006/01/prism-context"schemaLocation="prism-context-1.0.xsd" />
    	<xsd:element name="approveRequest">......</xsd:element>
    	<xsd:element name="approveRequestResponse">
    		......
    	</xsd:element>
    </xsd:schema>
    			

  5. As shown in Listing 3, add an additional part named context to the request message.

    Listing 3. Add context part to request message in ApprovalProcessInterface WSDL
    
    <wsdl:message name="approveRequestRequestMsg">
    	<wsdl:part element="tns:approveRequest"
    		name="approveRequestParameters" />
    	<wsdl:part element="bons2:Context" name="context" />
    </wsdl:message>
    <wsdl:message name="approveRequestResponseMsg">
    	<wsdl:part element="tns:approveRequestResponse"
    		name="approveRequestResult" />
    </wsdl:message>
    			

  6. Add header as an additional input in the binding definition of WSDL, as in Listing 4.

    Listing 4. Define SOAP header element as additional input in ApprovalProcessInterface WSDL binding
    <wsdl:binding
      name="ApprovalProcessExport_ApprovalProcessInterfaceHttpBinding"
      type="tns:ApprovalProcessInterface">
      <soap:binding style="document"
    	transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="approveRequest">
    	<soap:operation />
    	<wsdl:input name="approveRequestRequest">
    		<soap:body use="literal" />
    		<soap:header use="literal"
    		message="tns:approveRequestRequestMsg" part="context" />
    	</wsdl:input>
    	<wsdl:output name="approveRequestResponse">
    		<soap:body use="literal" />
    	</wsdl:output>
      </wsdl:operation>
    </wsdl:binding>
    			

  7. Save this WSDL file.

Add a Java snippet to set parameters in the SOAP header

In this step, you'll use SDO APIs to add the credit score of the applicant to the SOAP header as shown in the source code. We add a Java snippet: "Prepare the Fabric Context" with the code to the CreditCardApproval BPEL process.

  1. Double-click the BPEL component to open it.
  2. Create a variable named FabricContext whose type is ContextTypeExt, a XSD type defined in prism-context-1.0.xsd.
  3. Add a Java snippet before the invocation of the imported Web service ApprovalProcess.
  4. As shown in Listing 5, set the value of FabricContext using SDO APIs.

    Listing 5. Java source code for adding MinCreditScoreProperty and MaxCreditScoreProperty to context element in SOAP header
    String PRISM_CONTEXT_NS_URI = "http://www.webifysolutions.com/2006/01/prism-context";
    String WS_CONTEXT_NS_URI = "http://docs.oasis-open.org/wscaf/2005/10/wsctx";
    String PROPERTY_ELEMENT_TYPE = "ContextPropertyType";
    String context_type = "ContextTypeExt";
    String context_id_type = "contextIdentifierType";
    String SERVICE_INTERFACE = "http://www.webifysolutions.com/context/interface";
    String SUBSCRIPTION = "http://www.webifysolutions.com/context/subscription";
    String ELEMENT_VALUE = ":0";
    String ELEMENT_NAME_ATTRIBUTE = "name";
    String PROPERTY_ELEMENT = "property";
    String CONTEXT_IDENTIFIER_ELEMENT = "context-identifier";
    String BEGIN_CONTEXT = "prism:begin";
    String serviceInterface =
    	"http://CreditScoreCCApproval/ApprovalProcessInterface#ApprovalProcessInterface";
    String minCreditScoreProperty = 
    	"http://www.webifysolutions.com/2006/11/jivaro2_schm#MinCreditScore";
    String maxCreditScoreProperty = 
    	"http://www.webifysolutions.com/2006/11/jivaro2_schm#MaxCreditScore";
    
    //Instantiate the BOFactory
    BOFactory factoryService = (BOFactory) new ServiceManager().
    			locateService("com/ibm/websphere/bo/BOFactory");
    if (FabricContext==null)
    	FabricContext = factoryService.create(PRISM_CONTEXT_NS_URI,context_type);
    
    // CONTEXT IDENTIFIER --------------------------------------------
    DataObject element = factoryService.create(WS_CONTEXT_NS_URI,context_id_type);
    element.setString(ELEMENT_VALUE, BEGIN_CONTEXT);
    FabricContext.setDataObject(CONTEXT_IDENTIFIER_ELEMENT,element);
    
    // ADDITIONAL CONTEXT PROPERTIES ---------------------------------
    List properties = new java.util.ArrayList();
    DataObject property = null;
    
    // SERVICE INTERFACE
    property = factoryService.create(PRISM_CONTEXT_NS_URI, PROPERTY_ELEMENT_TYPE);
    property.setString(ELEMENT_VALUE, serviceInterface);
    property.setString(ELEMENT_NAME_ATTRIBUTE, SERVICE_INTERFACE);
    properties.add(property);
    
    // CONTENT MinCreditScore
    property = factoryService.create(PRISM_CONTEXT_NS_URI, PROPERTY_ELEMENT_TYPE);
    property.setString(ELEMENT_VALUE, CreditScore.toString());
    property.setString(ELEMENT_NAME_ATTRIBUTE, minCreditScoreProperty);
    properties.add(property);
    
    // CONTENT MaxCreditScore
    property = factoryService.create(PRISM_CONTEXT_NS_URI, PROPERTY_ELEMENT_TYPE);
    property.setString(ELEMENT_VALUE, CreditScore.toString());
    property.setString(ELEMENT_NAME_ATTRIBUTE, maxCreditScoreProperty);
    properties.add(property);
    
    FabricContext.setList(PROPERTY_ELEMENT,properties);
    			

  5. As shown in Figure 30, in the Invoke activity set FabricContext as the input parameter context.

    Figure 30. Add a Java snippet to set FabricContext variable in SOAP header
    Java snippet

  6. Save the change to this BPEL.

Set the URL of Dynamic Assembler as the endpoints of invoked Web services

In this step, you'll update the invocation link of the CreditCardApproval Web service (http://localhost:9080/fabric-engine/prism) so that the WBSF Dynamic Assembler can mediate requests to one of the two endpoints created in Create endpoints and metadata.

  1. Launch WebSphere Integration Developer, and switch to the Business Integration perspective.
  2. Double-click to open the module CreditCardApproval.
  3. In the Assembly Diagram view, as shown in Figure 31, select the Import component of the credit card approval process and show it in Properties.

    Figure 31. Set URL of Dynamic Assembler as endpoints of invoked Web services
    Assembly Diagram

  4. In the Properties view, click Binding. You may see the endpoint of this import. Replace it with the URL of Dynamic Assembler (http://localhost:9080/fabric-engine/prism).
  5. Save the diagram.

Installation tips

You might need to install or upgrade to the right version of WebSphere Application Server and WebSphere Process Server. The following tips supplement the instructions in the WBSF V6.0 Foundation Pack Installation guide to successfully install the WBSF FP:

  • Use the English version OS. If you don't have it, please add the OS environment SKIP_VERSION_CHECK=true before you start the installation.
  • Use DB2 Version 8.2.3 or 8.1, or with fixpack 10. 9.1.
  • Use WebSphere Process Server Version 6.0.1.3.
  • The WebSphere Process Server profile location path should be short; for example, x:/pf/p1.
  • WebSphere Process Server and DB2 should be running before launching the WBSF FP installation.
  • WebSphere Service Registry and Repository (WSRR) is not needed for WBSF installation.
  • If global security is enabled in WebSphere Process Server, disable it before installing WBSF.

To install WBSF V6.0 tool pack, follow these steps:

  • Use WebSphere Integration Developer Version 6.0.1.2 or later.
  • Install the tool pack to a location <WBSF_TP_Installation_Directory>
  • From WebSphere Integration Developer, add the WBSF plug-in from this site:
    <WBSF_TP_Installation_Directory>\Plugins\runtime\com.webify.wsf.studio.site-6.0.0.jar
  • Refer to <WBSF_TP_Installation_Directory>\Plugins\documentation\ FabricToolPackInstallGuide.pdf

To create an OCP file, the recommended method is discussed in Create a WBSF Ontology Content Pack file.


Comparing the WBSF solution to other possible solutions

The use case can also be implemented by using a mediation module with business rules in WebSphere Process Server. A mediation module is a type of SCA component that can be used to conditionally route a message to one or more target services based on the contents of the message. A business rule is a type of SCA component that can be used to capture and enforce policies.

For more information on SCA, mediation modules, business rules, and selectors see Resources.

The credit score limit for each endpoint (for example, 750) of the ApprovalProcessInterface can be implemented as a business rule so that it is configurable. A mediation module can be used to route the Invoke Approval Process service request to the appropriate endpoint.

A selector is another type of SCA component that can also be used to route a service invocation to one of several possible target implementation endpoints based on configuration. However, using a mediation module or a selector would both require writing Java code. In contrast, with WBSF the mediation logic is entirely implemented with content-based assertion (policies). The only code to write is for adding the credit score to the context element of the SOAP request. As a result, the WBSF solution is more flexible and configurable.

The advantage becomes apparent if the business requirements change in the future, requiring the addition of a new credit card approval subprocess (CCA3) for handling credit card applications for extremely low credit score applicants (credit score < 200). In the WBSF solution, the only changes required are 1) to add a new endpoint and a new CreditScoreAssertion instance with the MaxCreditScoreProperty set to 200 and the MinCreditScoreProperty set to 0; and 2) to change the MinCreditScore property of the CreditScoreAssertion associated with the LowCreditScoreEndpoint to 200. The alternative solution, with mediation modules or selectors and business rules, will require changing BPEL code and Java code, thus making it a costly solution to deploy.


Summary

This article describes how to use WBSF to achieve variability and dynamicity in a CBS application using a scenario of a credit card approval process. You learned how the WBSF core ontology can be extended (the CreditScoreAssertion) to create new criteria for routing decisions in a business process. The article also explains how dynamic endpoint selection in WBSF can be used for achieving late-binding of endpoints to service invocations.

Using WebSphere Business Services Fabric, instead of other techniques such as mediation module or selectors, has a few advantages:

  • Greater flexibility: No code change overhead when incorporating new extensions to business processes.
  • Greater configurability: Ability to change assertion properties (or policies) with adequate governance.

See a demo of WebSphere Business Services Fabric Dynamic Service Assembler

Show meShow me.

Download Adobe Flash Player.

See more about animated demos.

Animated demos

If this is your first encounter with a developerWorks article that includes demos, here are a few things you might want to know:
Demos are an optional way to see the same steps described in this article. To see an animated demo, click the Show me icon. The demo opens in a new browser window. Each demo contains a navigation bar at the bottom of the screen. Use the navigation bar to to pause, exit, rewind, or fast forward portions of the demo. The demos are 800 x 600 pixels. If this is the maximum resolution of your screen or if your resolution is lower than this, you will have to scroll to see some areas of the demo. JavaScript must be enabled in your browser and Macromedia Flash Player 6 or later must be installed.

Download Adobe Flash Player.



Downloads

DescriptionNameSizeDownload method
Resources mentioned in this articlear-cbspov2resource.zip294KBHTTP
source code WIDar-cbspov2resourceB.zip62KBHTTP

Information about download methods


Resources

Learn

Get products and technologies

Discuss

About the authors

Indrajit Poddar's photo

Indrajit Poddar (IP) is a member of the Strategy, Technology, Architecture and Incubation (STAI) team in the IBM Software Group, where he is architecting a number of PoCs for building SOA composite business services using IBM SOA Foundation products.

Photo of DuoWei (David) Sun

DuoWei (David) Sun is a staff software engineer in China Software Development Lab (CSDL). He is currently working in the SOA development area.

author photo

Dr. Germán Goldszmidt is a Distinguished Engineer working in the IBM Software Group, with focus on architecture of an integrated platform to deliver, customize, and deploy SOA composite business services. Previously, he was a researcher at the IBM T.J. Watson Research Center, and he led the design and implementation of several technologies, including Océano, the first prototype autonomic computing eUtility, and Network Dispatcher, the load balancer component of WebSphere products.

author photo

Ying Chun Guo works as a software engineer at the China Technology Institute, China Software Development Laboratory. She is currently working on composite business services (CBS) and Service-Oriented Architecture (SOA).

Comments (Undergoing maintenance)



Trademarks  |  My developerWorks terms and conditions

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=SOA and Web services, WebSphere
ArticleID=217347
ArticleTitle=Make composite business services adaptable with points of variability, Part 2: Using dynamic service mediation in WebSphere Business Services Fabric
publish-date=05082007
author1-email=ipoddar@us.ibm.com
author1-email-cc=flanders@us.ibm.com
author2-email=sunduow@cn.ibm.com
author2-email-cc=flanders@us.ibm.com
author3-email=gsg@us.ibm.com
author3-email-cc=flanders@us.ibm.com
author4-email=guoyingc@cn.ibm.com
author4-email-cc=

My developerWorks community

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Rate a product. Write a review.

Special offers