Websphere Process Server relationship service: Part 2, Dynamic relationships

This article describes how to build dynamic or identity relationships with IBM Websphere Integration Developer and run them in the unit test environment.

Share:

Zeenat Lainwala (lainwala@us.ibm.com), Advisory Software Engineer, IBM

Zeenat was the technical lead on the WebSphere Process Server RelationshipService 6.0. She has worked for IBM since 2002, initially on the WebSphere Integration Server product and for the last two years on the WebSphere Process Server product in multiple areas.



Shane Claussen (claussen@us.ibm.com), Senior Technical Staff Member, IBM

Shane Claussen is an architect for the WebSphere Process Server product and works out of the development lab in Burlingame, CA.



17 May 2006

Introduction

IBM® WebSphere® Process Server relationship service provides capabilities that enable integration developers to correlate properties that may have different values but have the same semantic meaning across a group of related business objects. There are two primary relationship types: dynamic and static. Dynamic relationships are typically used to correlate primary keys from a set of related business objects, whereas static relationships are typically used to correlate non-primary key properties. This article discusses dynamic relationships, Part 1, Static relationships shows you how to build static relationships using IBM WebSphere Integration Developer, and Part 3 (coming soon) focuses on dynamic composite relationships.

Business scenario

The business scenario used in this article assumes that the IBM Corporation has three different enterprise systems that have a representation of customer. The IBM IT organization has determined the need to integrate these three systems and provide a single composite canonical representation of the customer inside a Customer Relationship Management (CRM) Hub enabling customer relationship business processes to be developed independent of the existing Enterprise Information Systems (EIS).

Each enterprise system, SSA Global, SAP, and an IBM DB2® relational database, all have a representation of customer that contains a property named id, which represents the primary key. Each of these three systems generate the value of id. For example, the SSAGlobal system generates an id of 1 for customer, John Doe; the SAP system generates an id of 10 for the same customer, John Doe; and the DB2 system generates an id of 10A for John Doe. The id for the GBO customer in the canonical space is generated by the hub, which is 1. The dynamic relationship in this scenario correlates these four representations of customers that are basically the same customer but have different primary keys.

During the execution of this business integration application, the dynamic relationship is invoked when an incoming (or outgoing) event containing the customer business object is exchanged between the external systems and the CRM Hub. Those events are intermediated using the interface map component, which results in the invocation of a business object map. The business object map transforms the system-specific representation of the customer to/from the canonical representation. During that process, the business object map transforms the source id property to the target id property. This transformation is performed using the relationship service to lookup the correlated data for the pertinent source and target roles. The following diagram depicts the scenario:

Figure 1. Business scenario
Business scenario

Artifact development summary

To demonstrate how dynamic relationships can be used to solve this business scenario, let's' develop the following artifacts:

  • Four business objects (SSA Global, SAP, DB2, and Canonical) and two business graphs (SSA Global BG and Canonical BG).
  • A dynamic relationship containing four roles (a role for each business object).
  • Two business object maps, one that invokes the dynamic relationship to perform a transformation on the id property and another business graph map that calls the business object map.
  • An interface map with a source interface and a target interface that invokes the business object map.

This article assumes that you are familiar with creating Business Objects, Interfaces, Interface Maps, and Business Object Maps.


Create the business objects

In this step, create the four business objects and two business graphs required by the subsequent steps.

  1. Start IBM WebSphere Integration Developer.
  2. Create a new module named CRM, (choose File => New => Project).
  3. Create a customer business object for the three enterprise systems and a fourth for the canonical representation. For simplicity sake, the example uses the same property names for each of the business objects. Use the following to create each business object:
    Figure 2. Business Objects
    Business Objects
  4. Create the following properties and property types for each of the four business objects:
    Figure 3. SAPCustomer and SSACustomer
    SAPAndSSACustomer
    Figure 4. JDBCCustomer and GBOCustomer
    JDBCAndGBOCustomer
  5. Dynamic relationships need the verb or the change summary information in the business graph. Hence you need to create business graphs for the business objects. In this scenario, you create only for the SSAGlobal and the canonical business objects. You can create the rest of the business graphs to create a complete end-to-end scenario.
  6. Right-click on the business objects and select Create a Business Graph.
    Figure 5. SSACustomerBG and GBOCustomerBG
    JDBCAndGBOCustomer

Create the relationship

Now that you've created the business objects, you can create the relationship. The relationship defines a dynamic relationship for the primary key id property for each of the four business objects.

  1. Create a relationship, (choose File => New => Relationship).
  2. In the first panel, specify the target namespace: http://www.ibm.com/rels/CustomerId and name CustomerId.
  3. Click Next.
    Figure 6. Create the relationship
    RelationshipCreation
  4. On the next panel, keep the defaults. This indicates that the relationship will be created for a primary key property named: id.
Figure 7. Create the relationship
RelationshipCreation2

Add the roles

A role must be associated with each business object that participates in the relationship. The role represents metadata that describes which property in the business object will be correlated to the properties described in the others roles that are part of the relationship. Thus for this scenario, create four roles, one for each of the customer business objects.
To create each of the four roles, select the Add Role icon from the relationship editor pictured below:

Figure 8. Add Role
RoleAdd

A dialog then pops up where the business object associated with the role can be selected. Select the business object and click Ok. Repeat this until you have created a role for each of the business objects (JDBCCustomer, SSACustomer, SAPCustomer, and GBOCustomer).

Modify the role properties

Each role has its target namespace and name automatically generated. It is a good idea at this point to update the target namespace, name, and display name for each role. To do this:

  1. Select the role.
  2. Select Properties from the horizontal list of items below the roles.
  3. Select Description from the vertical list of items below the Properties tab.
  4. Update the Name, Display Name, Targetnamespace attributes using values from the following table:
    Figure 9. Role names
    RoleAdd
  5. Repeat this for all four roles.

Set the managed role

The canonical role (GBO) is a managed role for this identity relationship. This means that the GBO's ids are generated by WebSphere Process Server Relationship Service.

  1. Select the GBO role.
  2. Select Properties from the horizontal list of items below the roles.
  3. Select Details from the vertical list of items below the Properties tab.
  4. Check the Managed checkbox.
Figure 10. Mark Managed Role
ManagedRole

Add the role keys

Each of the four roles must now have its key set to the property that correlates across the relationship (for example, id). To set the key property (alias, key attribute):

  1. Select the role.
  2. Select the icon labeled Add KeyAttribute. See Figure 11 for an example:
    Figure 11. Add the Role Key Attributes
    RoleKeyAttributes
  3. This pops up a dialog of all the properties in the business object associated with the role. For this scenario, select id.
  4. Repeat this for all four roles.

Identity relationship definition summary

At this point, you have defined the dynamic relationship. This relationship defines enough information to enable the id property to be canonicalized and decanonicalized during the transformation of the EIS customer business objects to/from the canonicalized customer business object. To demonstrate each of the integration relationships between the CRM Hub and the external systems, three interface maps and six corresponding sets of business object maps would need to be developed to handle these integration scenarios:

  • SSA Global to/from the CRM Hub
  • SAP to/from the CRM Hub
  • DB2 to/from the CRM Hub

To keep this example simple, create the interface map for SSA Global to/from the CRM Hub using a simple set of source/target interfaces. Then create two business object maps to handle the inbound scenario where an SSA Global customer business object is transformed to a canonical customer business object and a SSA Global customer business graph is transformed to a canonical customer business graph. You can create the remaining two interface maps and five business object maps is extra credit!


Create the business object map

Create a business object map to transform a SSA Global business object to a canonical business object. Use the relationship transformation to transform the source business object's id property to the target business object's id property.

  1. Create a business object map, (choose File => New => Business Object Map).
  2. On the first panel, name the business object map SSACustomerToGBOCustomer and specify the target namespace http://www.ibm.com/maps.
  3. Click Next.
  4. On the second, panel select SSACustomer as the input and GBOCustomer as the output.
  5. Click Finish.
  6. Create a Relationship transformation between the SSACustomer to the GBOCustomer business objects.
  7. Create a Move transformation between every property of SSACustomer to the same property in GBOCustomer with the exception of id.
Figure 12. SSACustomerToGBOCustomer Map
SSACustomerToGBOCustomer

Create the business graph map

Dynamic relationships depend on the verb property or change summary information contained in the business graph to do automatic maintenance of role instances. Since the verb property is set to a business graph, you need to create a business graph map that further calls the above submap that contains the relationship transform. This map transforms an SSA Global business graph to a canonical business graph.

  1. Create a business object map, (choose File => New => Business Object Map).
  2. On the first panel, name the business object map SSACustomerBGToGBOCustomerBG and specify the target namespace http://www.ibm.com/maps.
  3. Click Next.
  4. On the second panel, select SSACustomerBG as the input and GBOCustomerBG as the output.
  5. Click Finish.
  6. Create a Submap transformation between the SSACustomer to the GBOCustomer business objects.
  7. Create a Move transformation between the verb property of SSACustomerBG to the verb property in GBOCustomerBG.
Figure 13. SSACustomerBGToGBOCustomerBG Map
SSACustomerBGToGBOCustomerBG

Create the interfaces

Prior to creating an interface map that invokes the SSACustomerBGToGBOCustomerBG map, create a source and target interface for the interface map.

  1. Create a source interface, (choose File => New => Interface).
  2. Name the interface SSAEvent and give it the target namespace http://www.ibm.com/interfaces/ssa.
  3. Add a request/response operation named processEvent.
  4. Add an input message named ssaCustomerBG of type SSACustomerBG.
    Figure 14. Interface SSAEvent
    InterfaceSSAEvent
  5. Create a target interface, (choose File => New => Interface).
  6. Name the interface GBOEvent and give it the target namespace http://www.ibm.com/interfaces/hub.
  7. Add a request/response operation named processEvent.
  8. Add an input message named gboCustomerBG of type GBOCustomerBG.
Figure 15. Interface GBOEvent
InterfaceGBOEvent

Create the Interface Map

Create the interface map for the SSA Global to/from the CRM Hub.

  1. Create a source interface, (choose File => New => Interface Map).
  2. Name it SSACustomerBGToFromGBOCustomerBG and give it the target namespace http://www.ibm.com/interfaceMaps.
  3. Click Next.
  4. Select the Source interface as the SSAEventBG interface.
  5. Select the Target interface as the GBOEventBG interface.
  6. Click Finish.
  7. Connect the processEvent operations.
  8. Select the line that connects the processEvent operations to view the Parameter mappings.
  9. Connect ssaCustomerBG to gboCustomerBG.
  10. Select move and then select Properties from the horizontal tab below the Parameter mappings.
  11. Select Description.
  12. Change move to map.
    Figure 16. Create the Interface Map
    InterfaceMap
  13. Select Details.
  14. Select SSACustomerBGToGBOCustomerBG for the Business Object Map.

Run the relationship

Now set up the assembly diagram to test the relationship via the interface map component.

  1. Open up the assembly diagram.
  2. Drag the Interface Map SSACustomerToFromGBOCustomer onto the assembly diagram surface.
  3. Drag a Java™ component onto the assembly diagram surface.
  4. Wire the Interface Map to the Java component. The Java component is needed so that the unit test environment can run without throwing an exception when it tries to resolve the interface map reference.
  5. At this point, you can test the component with your test server.
  6. Right-click on the Assembly Editor and select Test ModuleThis starts the test server and deploy the DynamicRelationship module to the test server.
  7. This brings up the Test Run Window with the business object.
  8. Change the verb to Create.
  9. Enter 1 as the id value.
  10. Enter John as the firstName.
  11. Enter Doe as the lastName.
    Figure 17. Test the run result
    TestRunResult
  12. Click Continue.
  13. Click on the Request in the Events side of the window.
Figure 18. Test the run result
TestRunResult

When the interface map is invoked with the business object SSACustomerBG, it calls the map which in turn calls the submap. The submap SSACustomerToGBOCustomer will invoke the relationship with the SSACustomer role. The verb is set to create. This invocation will cause the relationship service to generate a unique id for the GBOCustomer role. In this case, the id is 7. Relationship service will now save this correlation information of SSACustomer with id 1 corresponds to GBOCustomer with id 7. From here on, when an update or delete is sent through the system for the SSACustomer with id 1 and relationship is invoked, it will be able to map it to the correct GBOCustomer id which is 7.


Conclusion

This article shows how you can create an identity relationship, call the relationship from a map, create an interface map that calls the map, and test the relationship on the server.

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=112040
ArticleTitle=Websphere Process Server relationship service: Part 2, Dynamic relationships
publish-date=05172006