Você está na página 1de 80

Synchronize data between Siebel and SAP with

WebSphere Adapters and WebSphere Process Server


Albert Chung
Software Engineer, IBM
Research Triangle Park, Durham NC
January, 2007

© Copyright International Business Machines Corporation 2007. All rights reserved.

This article shows you how to create an SOA application to dynamically synchronize
customer data from Siebel to SAP. The application is built on IBM WebSphere
Integration Developer Version 6.0.2; it uses WebSphere Adapter for Siebel Business
Application Version 6.0.2 and WebSphere Adapter for SAP Software Version 6.0.2. The
application runs on WebSphere Process Server Version 6.0.2. Based on a sample end-to-
end business scenario, this article takes you step-by-step through the process of creating
integration modules, adapter import and export components, mediation components, and
business process components.

SAP and Siebel are complex Enterprise Information Systems that use different formats to
represent data. In this article, you’ll learn the techniques required to enable successful
integration of data from Siebel to SAP. You’ll learn how about event sequencing, a new
feature in WebSphere Process Server Version 6.0.2, and how to apply it to the sample
data synchronization solution. Data mapping from an element to another element inside
an array is currently not supported by the tools, but such mapping is needed to map a
Siebel business object to a SAP business object. You’ll learn how to work around this
tools limitation.

This article assumes you have a moderate understanding of WebSphere Integration


Developer, WebSphere Adapters and WebSphere Process Server. It also assumes you
have installed WebSphere Integration Developer Version 6.0.2 along with WebSphere
Process Server’s test environments.

1
Synchronize data between Siebel and SAP with WebSphere Adapters and WebSphere
Process Server......................................................................................................................1
Introduction.......................................................................................................................... 2
Sample business scenario.....................................................................................................2
Scenario development overview...................................................................................... 3
Create a library, common business objects and interfaces.................................................. 5
Create a Siebel inbound module.......................................................................................... 9
Create a SAP outbound module......................................................................................... 18
Configure Siebel interface mediation and mapping...........................................................26
Configure SAP interface mediation and mapping............................................................. 29
Create a BPEL module.......................................................................................................45
Configure relationships...................................................................................................... 50
Configure dynamic relationships................................................................................... 50
Configure static relationships........................................................................................ 55
Create a static relationship in the Siebel inbound module ........................................ 56
Create a static relationship in the SAP outbound module .........................................59
Configure event sequencing............................................................................................... 70
Specify an event sequencing qualifier for the Siebel mediation component ............ 72
Specify an event sequencing qualifier for DataSyncProcess .................................... 73
Configure the Siebel adapter export for event sequencing........................................ 74
An example of an event flow with event sequencing qualifiers specified................. 74
Test the end-to-end scenario.............................................................................................. 75
Test the create account............................................................................................... 75
Create a new Siebel Account:.................................................................................... 77
View the new customer in SAP................................................................................. 78
Test the update account.............................................................................................. 79
Conclusion......................................................................................................................... 80
About the author................................................................................................................ 80

Introduction
WebSphere Adapter for SAP Software and WebSphere Adapter for Siebel Business
Applications are implemented using the Java™ 2 Enterprise Edition (J2EE) Connector
Architecture (JCA) 1.5 specification. These adapters enable managed bi-directional
connectivity and data exchange between enterprise information systems (EIS) such as
SAP and Siebel and integration modules and components running on WebSphere Process
Server.

This article shows you how to synchronize accounts on a Siebel sales application to
customers on a SAP general ledger application.

Sample business scenario


The sample business scenario assumes a company is using a Siebel sales application as its
front office system and SAP as its back office system. Each system has its own
representation and persistence of customer data. In this scenario, the company has

2
decided to enhance the internal business processes to automatically synchronize the
customer data from Siebel to SAP, as well as provide real-time updates between these
systems. For example, if a new customer is added to Siebel, the data for this customer is
sent to SAP, where a new SAP customer is automatically created. If the information for
this customer is changed in Siebel, the changes are automatically replicated to SAP for
the corresponding SAP customer. See Figure 1.

Figure 1. Sample business scenario

` Create/Update Create/Update
Siebel Account SAP Customer
event event

Scenario development overview


SOA has the concept of composing applications from loosely coupled reusable services.
WebSphere Process Server and WebSphere Integration Developer provide the platform
infrastructure and the tools for SOA applications. In keeping with SOA concepts, our
data synchronization project consists of three business integration modules, or services, a
library. Each module represents a reusable unit that can be used to build other SOA
applications.
• Library – The library holds common interfaces, business object definitions and
relationships that are used by integration modules. The library cannot be
deployed by itself, but must be included as part of an integration module.

• Siebel Inbound Module – This module consists of a Siebel adapter (to process
Siebel inbound events), a mediation component (interface maps), and an SCA
import (to invoke services from the BPEL module). The Siebel adapter in this
module polls Siebel’s event table. If events are found, it will retrieve the events
and deliver them to the mediation component. The mediation component contains
interface maps, data maps and relationships. It transforms Siebel-specific
interface data to a generic format that can be consumed by business process in the
BPEL module. The import component invokes the BPEL module. The business
process in the BPEL module automatically processes the incoming transformed
Siebel event. See Figure 2.

3
Figure 2. Siebel inbound module
Siebel Inbound Module

Interface Import
I Siebel Export R I Mediation R I BPEL
(Inbound) & Mapping Service

• BPEL module – This module contains a simple BPEL business process


component. The business process checks the verb of the incoming business
object. If the verb is create, it will invoke a SAP outbound module to create a
new customer in SAP. If the verb is update, it will invoke SAP outbound module
to update a customer in SAP. The business process service is made available to
other modules through the export component. It invokes the SAP outbound
service through the import component. See Figure 3.

Figure 3. BPEL module


BPEL Module

Export BPEL Import


I BPEL R I Business R I SAP
Service Process Service

• SAP outbound module – This module consist of an SCA export (which allows
other modules to invoke its service), a mediation component (interface maps) and
a SAP adapter import to process outbound events. The mediation component
contains an interface map, data maps and relationships. It transforms the generic
interface data to the SAP-specific interface and data format. See Figure 4.

4
Figure 4. SAP outbound module
SAP Outbound Module

Export Interface
SAP Import
I SAP R I Mediation R I (Outbound)
Service & Mapping

In this article, you’ll learn how to create the library and integration modules. While
creating these modules, you’ll also learn how to:
• Create business object definitions
• Create business graphs
• Create interfaces
• Create relationships and relationship roles
• Install and configure Siebel adapter for inbound processing using a Siebel
business service
• Create and configure a trigger and event table in Siebel
• Install and configure a SAP adapter for outbound processing using the SAP BAPI
interface
• Create interface maps
• Create data maps
• Configure dynamic relationships
• Configure static relationships
• Configure event sequencing to preserve the order of events processed by
WebSphere Process Server
• Deploy and test the end-to-end scenario

Create a library, common business objects and


interfaces
The library holds common interfaces, business object definitions and relationships that
are used by more than one integration modules.

To create a library:
1. Start WebSphere Integration Developer and create a new workspace.
2. Right-click Business Integration view and select New -> Library.
3. In the New Library dialog, enter CustomerSyncLibrary, and click Finish.

5
Enterprise information systems use different formats to represent data. For example,
Siebel uses a Siebel Account object to represent a customer, while SAP uses a SAP
Customer object. To ensure loose coupling between services, data communicated
between services should be generic and not EIS-specific. You can create and store
generic business object definitions in the library so that they can be shared by
participating services in an SOA application. To create the generic business objects
needed for this scenario, do the following:

1. Create an Address business object by doing the following:


a. Right-click on CustomerSyncLibrary in the Business Integration view, then
select New -> Business Object.
b. Enter Address in the Name field of the New Business Object dialog, then
click Finish.
c. Add attributes to the Address business object as shown in Figure 5.

Figure 5. Create Address business object

1. Create a Customer business object by doing the following:


a. Repeat step 1, but use Customer as the business object name in step 1b.
b. Add attributes to the Customer business object as shown in Figure 6.
c. Select Address as the data type for the address attribute.
d. In the properties for the address attribute, check array as shown in Figure 6.
Address business objects are child objects of the Customer business object.

6
Figure 6. Create Customer business object

1. A business graph is used to wrap around business objects. A business graph contains
a verb attribute. The verb is used to indicate the event type for the business object.
To create a Customer business graph (CustomerBG), right-click the Customer
business object, then select Create a Business Graph.

Services are invoked through interfaces. The service invoker must know the service
provider’s interface. The definitions for these interfaces are created in the library and
used by the different modules. For this scenario we need two interfaces:
• CustomerDeliveryOneway – This interface is used to invoke the BPEL service.
This is a one-way interface - nothing is returned after method invocation. We
don’t need a response after invoking the BPEL business process service for this
scenario.
• CustomerDeliveryRequestRespone – This interface is used to invoke the SAP
outbound service. It is a request response interface. A business object is returned
after method invocation. A request response interface is needed here because we

7
need to get the SAP customer key for the relationship when a new SAP customer
is created. Relationships are discussed later in this article.

1. Create a CustomerDeliveryOneway interface by doing the following:


a. Under CustomerSyncLibrary, right-click Interfaces -> New -> Interface.
b. Enter CustomerDeliveryOneway in the Name field of the Create a new
interface dialog, and click Finish.
c. Click Add one way operation.
d. Change the operation name from operation1 to processCustomer.
e. Change the input name to inputCustomerBG.
f. Change input type to CustomerBG, as shown in Figure 7.

Figure 7. CustomerDeliveryOneway interface

1. Create a CustomerDeliveryRequestResponse interface by doing the following:


a. Under CustomerSyncLibrary, right-click Interfaces -> New -> Interface.
b. Enter CustomerDeliveryRequestResponse in the Name field of the Create a
new interface dialog, and click Finish.
c. Click Add Request Response Operation.
d. Change the operation name to createBackendCustomer.
e. Change the input name to inputCustomerBG.
f. Change the input type to CustomerBG.
g. Change the output name to returnCustomerBG.
h. Change the output type to CustomerBG.
i. Repeat steps c through h to create an operation called
updateBackendCustomer. See Figure 8.

8
Figure 8. CustomerDeliveryRequestResponse interface

Create a Siebel inbound module


WebSphere Adapter for Siebel Business Applications communicates with Siebel
applications by calling Siebel native APIs and exchanging data with Siebel application.
WebSphere Adapter for Siebel Business Applications is packaged in a file called
CWYEB_SiebelAdapter.rar. To install this adapter file and other related files such
messages and samples, run the Siebel adapter installer from the product CD. After
installation, you’ll find the adapter RAR file in the
<install_location>/adapter/Siebel/deploy directory. Before using the adapter, you need to
import the adapter RAR file into WebSphere Integration Developer.

We’ll use the Enterprise Service Discovery wizard in Integration Developer to discover
and select business objects in Siebel for our data synchronization business scenario.
Siebel adapter service artifacts are automatically generated by enterprise service
discovery.

Follow these steps to install and configure WebSphere for Siebel Business Applications:\

1. Start WebSphere Integration Developer.


2. Select the workspace where you created the library earlier.
3. Select File -> Import to open the Import dialog.

9
4. Select RAR file, then click Next as shown in Figure 9.
Figure 9. Import Siebel adapter into Integration Developer

5. In the next dialog, click Browse to open the file selection dialog, then navigate to
the <install_location>/adapter/Siebel/deploy directory. Select
CWYEB_SiebelAdapter.rar.
6. Uncheck Add module to an EAR project and click Finish, as shown in Figure
10. You’ll create the Siebel inbound integration module later when you run
enterprise service discovery.

10
Figure 10. Import Siebel adapter RAR file

7. Click Yes if you’re prompted to switch to J2EE perspective.


8. The Siebel adapter requires two dependent Siebel jar files to work: Siebel.jar and
SiebelJI_enu.jar. Copy and paste these two jar files into the connectorModule
directory as shown in Figure 11.

Figure 11. Adding dependent jar files to connector project

11
9. Add the dependent jar files to the connector project class path by right-clicking
CWYEB_SiebelAdapter under Connector Projects, and selecting Properties.
10. In the Properties dialog, select Java Build Path, then click the Libraries tab as
shown in Figure 12.

Figure 12. Connector project properties dialog

11. Click Add JARs to open JAR selection dialog, and select the two jar files, as
shown in Figure 13, then click OK.

12
Figure 13. Add dependent jar files

12. Click OK to close the Properties dialog.


13. Switch from the J2EE perspective to the Business Integration perspective.
14. We use enterprise service discovery to discover and select objects on Siebel for
our data synchronization scenario. Enterprise service discovery also generates
service artifacts. The service artifact binds the EIS connection to the adapter. It
also binds the service interface to adapter operations. Finally it binds service data
objects to adapter data types. To start enterprise service discovery, click File ->
New -> Enterprise Service Discovery.
15. Select IBM WebSphere Adapter for Siebel Business Applications, then click
Next as shown in Figure 14.

Figure 14. Enterprise Service Discovery

16. Enter connection information as shown in Figure 15. Substitute the appropriate
IP address, user name and password for your environment.

13
Figure 15. Enter connection information

17. Select Siebel Business Services, then click Next.


18. In the next dialog, click Edit Query to filter the number of business services
returned from querying Siebel.
19. Enter Siebel Account in the Query Filter Properties dialog as shown in Figure
16, then click OK.

14
Figure 16. Filter Siebel business services

20. In the Find and Discover Enterprise Services dialog, click Execute Query.
21. From the query results, select QueryByExample under Siebel Account.
22. Click Add to import list.
23. In the Configuration Parameters dialog, enter the event method name
QueryByExample, then click OK as show in Figure 17.

Figure 17. Configuration Parameters

24. In the Configure Objects dialog, select Inbound as the service type and enter
SiebelBO as the location where enterprise service discovery-generated business
objects will be saved, then click Next, as shown in Figure 18.

15
Figure 18. Select inbound service type

25. In the Generate Artifacts dialog, click New to create a new integration module for
Siebel inbound.
26. Select Create a module project then click Next.
27. Enter SiebelInboundModule as the new module name, then click Next.
28. Select CustomerSyncLibrary in the Select Required Libraries dialog, then click
Finish.
29. In the Generate Artifacts dialog, enter widNode/Siebel_Alias in the J2C
Authentication Data Entry field. In this scenario, we’re using the WebSphere
Process Server that is installed with WebSphere Integration Developer. If your
environment is different, you should use the appropriate node name. This
authentication alias will be used to connect to Siebel.
30. Ensure that the event Delivery Type is set to ORDERED and Assured once
delivery is checked. We‘ll explain these settings in more detail later.
31. Enter a User Name and Password.
32. Enter IBM2 as the Event Component Name. See the WebSphere Adapter
documentation for information on how to configure a event table on Siebel.
33. Accept the default settings for the rest of the fields, and click Finish, as shown in
Figure 19.

16
Figure 19. Properties in Generate Artifacts dialog

17
Siebel enterprise service discovery has created a Siebel inbound interface, Siebel business
objects and Siebel export binding definitions in the Siebel inbound module, as shown in
Figure 20.

Figure 20. Siebel inbound module

Create a SAP outbound module


WebSphere Adapter for SAP Software communicates with SAP through SAPJCO API
calls. WebSphere Adapter for SAP Software is packaged in files called
CWYAP_SAPAdapter_Tx.rar (which supports local transactions) and
CWYAP_SAPAdapter.rar. To install the adapter files and other related files (such as
messages and samples), run the SAP adapter installer from the product CD. After
installation, you’ll find the adapter RAR files in the
<install_location>/adapter/SAP/deploy directory. Before using the adapter, you need to
import the adapter RAR files into Integration Developer.

Complete the following steps to install and configure WebSphere for SAP Software.
These steps are similar to installing and configuring Siebel adapter. Use the screen
captures for installing and configuring Siebel adapter as reference.

1. Install WebSphere for SAP Software on a machine where WebSphere Integration


Developer is installed.
2. In Integration Developer, select File -> Import to open the Import dialog.
3. Select RAR file, then click Next.

18
4. In the next dialog, click Browse to open the file selection dialog, then navigate to
the <install_location>/adapter/SAP/deploy directory. Select
CWYAP_SAPAdapter_Tx.rar.
5. Uncheck the Add module to an EAR project, and click Finish. The SAP
outbound integration module is created later when yoy run enterprise service
discovery.
6. Click Yes if you’re prompted to switch to J2EE perspective.
7. On a Windows system, you need to add the directory containing the following
dependent SAPJCO DLLs to the PATH system variable. You should reboot your
machine after updating system variables.
• librfc32.dll
• MSVCP71.DLL
• msvcr71.dll
• sapjcorfc.dll
• sqljdbc.dll
8. Copy the dependent sapjco.jar to the Process Server \classes directory. For
example, if you’re using the Process Server test environment that is installed with
Integration Developer, put the sapjco.jar file in <Integration_Developer_install_
location>\runtimes\bi_v6\classes directory. This jar file is used at runtime.
9. Add sapjco.jar to the connector project’s class path. Right-click
CWYAP_SAPAdapter_Tx under Connector Projects, then select Properties.
10. In the Properties dialog, select Java Build Path, then click the Libraries tab as
shown in Figure 21.

Figure 21. Connector project properties dialog

19
11. Click Add External JARs to open the file selection dialog. Note: Do not copy
and paste sapjco.jar into the connector as you did with the Siebel dependent jar
files; sapjco.jar cannot be deployed with the connector project to Process Server.
Instead, add sapjco.jar to the class path for running SAP enterprise service
discovery.
12. Navigate to the directory where sapjco.jar is located. Select sapjco.jar, then click
OK.
13. Click OK to close the Properties dialog.
14. Switch from the J2EE perspective to the Business Integration perspective.
15. We use enterprise service discovery to discover and select SAP business objects.
Enterprise service discovery also generates service artifacts. A service artifact
binds an EIS service to service components. To start enterprise service discovery,
click File -> New -> Enterprise Service Discovery.
16. Select IBM WebSphere Adapter for SAP Software, then click Next.
17. Enter connection information as shown in Figure 22. Substitute the appropriate
SAP server host name, client, user name, and password for your environment.
18. Select BAPI for the SAP interface then click Next.

20
Figure 22. Enter connection information

19. On the next dialog click Execute Query.


20. Select Discover By Name under RFC, then click Filter as show in Figure 23.

21
Figure 23. Query SAP objects

21. In the Filter dialog enter BAPI_Customer*.


22. Select BAPI_CUSTOMER_CREATEFROMDATA1 and
BAPI_CUSTOMER_CHANGEFROMDATA1, and click Add to import list.
23. In the Configuration Parameters dialog, set the properties as shown in Figure 24
and Figure 25.

22
Figure 24. Properties for BAPI_CUSTOMER_CREATEFROMDATA1

Figure 25. Properties for BAPI_ CUSTOMER_CHANGEFROMDATA1

23
24. Click Next.
25. Enter the information as shown in Figure 26 in the Configure Objects dialog.

Figure 26. Configure Objects

26. Click Next.


27. In the Generate Artifacts dialog, click New to create a new integration module for
SAP outbound.
28. Select Create a module project then click Next.
29. Enter SAPOutboundModule as the new module name then click Next.
30. Select CustomerSyncLibrary in the Select Required Libraries dialog, and click
Finish.
31. In the Generate Artifacts dialog, enter widNode/SAP_Auth_Alias in the J2C
Authentication Data Entry field. If you are not using the WebSphere Process
Server that is installed with WebSphere Integration Developer, substitute the
appropriate node name for than widNode.
32. Accept the default settings for the rest of the fields, and click Finish, as shown in
Figure 27.

24
Figure 27. Properties in Generate Artifacts dialog

25
SAP enterprise service discovery has now created SAP inbound interface, SAP business
objects, and SAP import binding definitions in the SAP outbound module. See Figure
28.

Figure 28. SAP outbound module.

Configure Siebel interface mediation and mapping


Software components and services in an SOA need to be loosely coupled. To achieve
this loose coupling, you need to transform Siebel-specific business objects and interfaces
to generic business objects and interfaces. These generic business objects and interfaces
can be used across different modules. You already created a generic Customer business
object and CustomerDeliveryOneway interface. In our business scenario, data is flowing
in from Siebel to the Siebel inbound module. We need to transform the Siebel-specific
data to generic data that can be consumed by another module.

The following steps show you how to mediate the SiebelInboundInterface to the
CustomerDeliverOneway interface and map Siebel-specific account objects to generic
Customer business objects. There are two approaches to mapping. One way is starting
mapping from the lowest submap level, creating the lowest submap first, then creating
the next higher level submap on top of the lower level submap. You repeat this mapping
up to the interface map level. The second approach is to start mapping from the interface
map level and work your way down to the lowest submap. We’ll use the first method in
this article. Figure 29 shows the mapping between the Siebel business object and the
Customer business object.

26
Figure 29. Mapping between Siebel business object and Customer business object
Siebel BO Customer BO
Structure Structure
IOAccountInterface Map
CustomerBG
ICAccountBG

IOAccountInterface Sub map


Customer
ICAccount

IOAccountInterface Sub map


Address[ ]
ICBusinessAddress

Complete the following steps to create the necessary mapping.

1. To create the IOAccountInterfaceICBusinessAddress_To_Address data map:


a. In SiebelInboundModule, right-click on Data Maps, and select New ->
Business Object Map.
b. In the Name field, enter
IOAccountInterfaceICBusinessAddress_To_Address, and click Next.
c. Select IOAccountInterfaceICBusinessAddress as the input and Address as
the output, then click Finish.
d. Wire the attributes as shown in Figure 30.

Figure 30. Map Siebel address business object to generic address object

2. To create the IOAccountInterfaceICAccount_To_Customer data map:


c. In SiebelInboundModule, right-click Data Maps and select New -> Business
Object Map.
d. In the Name field, enter IOAccountInterfaceICAccount_To_Customer, and
click Next.

27
e. Select IOAccountInterfaceICAccount as the input and Customer as the
output, then click Finish.
f. Wire the name attribute from IOAccountInterfaceICAccount to the
Customer’s name attribute as a Move.
g. Wire BusinessAddress from IOAccountInterfaceICBusinessAddress to
Customer’s address attribute as a Submap.
h. In the Submap properties dialog, click the Details tab.
i. In the Business object map field, select
IOAccountInterfaceICBusinessAddress_To_Address.

1. To create the IOAccountInterfaceICAccountBG_To_CustomerBG data map:


a. In SiebelInboundModule, right-click Data Maps, and select New -> Business
Object Map.
b. In the Name field, enter
IOAccountInterfaceICAccountBG_To_CustomerBG, then click Next.
c. Select IOAccountInterfaceICAccountBG as the input and CustomerBG as
the output, then click Finish.
d. Wire the verb attribute from IOAccountInterfaceICAccountBG to
CustomerBG’s verb attribute as a Move.
e. Wire IOAccountInterfaceICAccount to Customer as a Submap.
f. In the Submap properties dialog, click the Details tab.
g. In the Business object map field, select
IOAccountInterfaceICAccount_To_Customer.

2. To create the SiebelInboundInterface_To_CustomerDeliveryOneway interface


map:
a. In SiebelInboundModule, right-click Interface Maps, and select New ->
Interface Map.
b. In the Name field, enter
SiebelInbountInterface_To_CustomerDeliveryOneway, then click Next.
c. Select SiebelInboundInterface as the source interface and
CustomerDeliveryOneway as the destination interface, then click Finish.
d. In the interface map editor, wire
emitCreateAfterImageIOAccountInterfaceICAccount to processCustomer
operation.
e. Select the connecting wire from above. The parameter mapping appears.
f. Wire IOAccountInterfaceICAccountBG to CustomerBG. See Figure 31.

28
Figure 31. Siebel interface mediation

g. Change the parameter mapping type from move to map in the move
properties editor.
h. In the Details tab, select
IOAccountInterfaceICAccountBG_To_CustomerBG.
i. Wire emitUpdateAfterImageIOAccountInterfaceICAccount to
processCustomer.
j. Select the connecting wire in the above step.
k. Repeat step f through h.

You’ve now finished creating the necessary Siebel interface mediation and mapping.
The final two steps are to drag and drop the newly created interface map from the
Business Integration view to the Siebel inbound module’s assembly diagram, then wire
SiebelInboundInterface to SiebelInboundInterface_To_CustomerDeliveryOneway, as
shown in Figure 32.

Figure 32. Connect Siebel export to Siebel interface mediation

Configure SAP interface mediation and mapping


The Siebel inbound module transforms the Siebel-specific data format to a generic data
format. This generic data flows through the BPEL module and into the SAP outbound
module. The incoming data is in generic format. In order to invoke SAP adapter
operations, you need to transform the incoming data from the generic data format to the

29
SAP-specific data format. SAP business object structures are quite different from the
incoming Customer business object structures. Separate business objects are used for the
create and update operations. To perform a Customer create operation, you need to map
CustomerBG to SapCust_WrapperBG. This map will contain a Customer to
SapBapiCustomerCreatefromdata1 submap, as shown in Figure 33.

Figure 33. CustomerBG to SapCust_WrapperBG for create operation


Customer BO SAP BO
Structure Structure
Map
CustomerBG SapCust_WrapperBG

SapCust_Wrapper

Customer

SapBapiCustomer
Changefromdata1

Address[ ]

Sub map SapBapiCustomer


Createfromdata1

To perform a Customer update operation, you need to map CustomerBG to


SapCust_WrapperBG. This map will contain a Customer to
SapBapiCustomerChangefromdata1 submap, as shown in Figure 34.

30
Figure 34. CustomerBG to SapCust_WrapperBG for update operation
Customer BO SAP BO
Structure Structure
Map
CustomerBG SapCust_WrapperBG

SapCust_Wrapper

Customer

Sub map SapBapiCustomer


Changefromdata1

Address[ ]

SapBapiCustomer
Createfromdata1

The following steps show you how to mediate the CustomerDeliveryRequestResponse


interface to SAPOutboundInterface and map CustomerBG to SapCust_WrapperBG.

To create the Customer_To_SapBapiCustomerCreatefromdata1 data map:


a. In SAPOutboundModule, right-click Data Maps, and select New -> Business
Object Map.
b. In the Name field, enter Customer_To_SapBapiCustomerCreatefromdata1,
and click Next.
c. Select Customer as the input and SapBapiCustomerCreatefromdata1as the
output, and click Finish.
d. To invoke SAP BAPI to create and update the customer, certain fields are
required. Some of these fields are not available from the incoming Customer
business object. You need to manually assign values for these required fields.
Assign the following values to the SapBapiCustomerCreatefromdata1
attributes. Depending on your SAP system set-up, these values may be
different in your environment.

Table 1. Required attributes for SAP customer create BAPI


Attribute Value
Salesorg 0001
DistrChan 01
Division 01
RefCustmr 0000000001
LanguP EN
Currency USD

31
e. If you compare the Customer business object and the
SapBapiCustomerCreatefromdata1 business object, you’ll notice that
Customer has an array of Address child objects while
SapBapiCustomerCreatefromdata1 has just one address per customer.
Currently Integration Developer tools don’t allow you to pick an array
element from the Address array and map it to one SAP address. However,
you can work around this by directly editing the map source file. To open the
map source file, right-click
Customer_To_SapBapiCustomerCreatefromdata1, and select Open With
-> Text Editor.
f. For each attribute in the Address object that you want to map, you need to add
an XML code segment. For example, if you want to map the city attribute
from the first Address business object element in the Address array to
SapBapiCustomerCreatefromdata1’s city, add:
<map:propertyMap executionOrder="7">
<map:move>
<map:input businessObjectVariableRef="Customer"
property="address.0/city"/>
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata
1" property="SapPiPersonaldata1389002469/City"/>
</map:move>
</map:propertyMap>
Note that property=”address.0/city” indicates the city attribute of the first
element (index 0) in the address array. The rest of the XML attributes and
elements are self-explanatory.
g. Split the name attribute of the Customer business object and map the parts to
the Firstname and Lastname attributes of
Customer_To_SapBapiCustomerCreatefromdata1.

Here is an example of the complete map source file:

<?xml version="1.0" encoding="UTF-8"?>


<map:businessObjectMap xmlns:Customer="http://CustomerSyncLibrary"
xmlns:Customer_To_SapBapiCustomerCreatefromdata1="http://SAPOutboundMod
ule"
xmlns:SapBapiCustomerCreatefromdata1="http://www.ibm.com/xmlns/prod/web
sphere/j2ca/sap/sapbapicustomercreatefromdata1"
xmlns:map="http://www.ibm.com/xmlns/prod/websphere/wbiserver/map/6.0.0"
targetNamespace="http://SAPOutboundModule">
<map:name>Customer_To_SapBapiCustomerCreatefromdata1</map:name>
<map:inputBusinessObjectVariable
businessObjectRef="Customer:Customer" name="Customer"/>
<map:outputBusinessObjectVariable
businessObjectRef="SapBapiCustomerCreatefromdata1:SapBapiCustomerCreate
fromdata1" name="SapBapiCustomerCreatefromdata1"/>
<map:propertyMap executionOrder="1">
<map:set value="0001">
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiCopyreference/Salesorg"/>
</map:set>

32
</map:propertyMap>
<map:propertyMap executionOrder="2">
<map:set value="01">
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiCopyreference/DistrChan"/>
</map:set>
</map:propertyMap>
<map:propertyMap executionOrder="3">
<map:set value="01">
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiCopyreference/Division"/>
</map:set>
</map:propertyMap>
<map:propertyMap executionOrder="4">
<map:set value="0000000001">
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiCopyreference/RefCustmr"/>
</map:set>
</map:propertyMap>
<map:propertyMap executionOrder="5">
<map:split delimiter=" " position="0">
<map:input businessObjectVariableRef="Customer" property="name"/>
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/Firstname"/>
</map:split>
</map:propertyMap>
<map:propertyMap executionOrder="6">
<map:split delimiter=" " position="1">
<map:input businessObjectVariableRef="Customer" property="name"/>
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/Lastname"/>
</map:split>
</map:propertyMap>
<map:propertyMap executionOrder="7">
<map:move>
<map:input businessObjectVariableRef="Customer"
property="address.0/city"/>
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/City"/>
</map:move>
</map:propertyMap>
<map:propertyMap executionOrder="8">
<map:move>
<map:input businessObjectVariableRef="Customer"
property="address.0/postalCode"/>
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/PostlCod1"/>
</map:move>
</map:propertyMap>
<map:propertyMap executionOrder="9">

33
<map:move>
<map:input businessObjectVariableRef="Customer"
property="address.0/address1"/>
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/Street"/>
</map:move>
</map:propertyMap>
<map:propertyMap executionOrder="10">
<map:move>
<map:input businessObjectVariableRef="Customer"
property="address.0/country"/>
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/Country"/>
</map:move>
</map:propertyMap>
<map:propertyMap executionOrder="11">
<map:set value="EN">
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/LanguP"/>
</map:set>
</map:propertyMap>
<map:propertyMap executionOrder="12">
<map:set value="USD">
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/Currency"/>
</map:set>
</map:propertyMap>
</map:businessObjectMap>

34
Figure 35 shows the completed map in the map editor.

Figure 35. Map Customer to SapBapiCustomerCreatefromdata1

1. To create the Customer_To_SapBapiCustomerChangefromdata1 data map, use the


same steps that you used to create the
Customer_To_SapBapiCustomerCreatefromdata1 data map, except the name of map
is Customer_To_SapBapiCustomerChangefromdata1 and the output business object
is SapBapiCustomerChangefromdata1, instead of SapBapiCustomerCreatefromdata1.
Map the attributes as shown in Figure 36.

35
Figure 36. Map Customer to SapBapiCustomerChangefromdata1

Notice that Customer name and address information is mapped to attributes in the
SapPiPersonaldata child object of the SapBapiCustomerChangefromdata1 business
object. Notice also that there is a SapPiPersonaldatax child object under
SapBapiCustomerChangefromdata1. Both SapPiPersonaldata and SapPiPersonaldatax
have the same attributes. If you want to update a field in SapPiPersonaldata, you need to
set the corresponding field in SapPiPersonaldatax with the character X. Figure 37 shows
that we assigned an X to the fields that we want to update.

36
Figure 37. Assign an X to the attributes that we wish to update

2. To create the CustomerBG_To_SapCust_WrapperBG_createOp data map:


c. In SAPOutboundModule, right-click Data Maps, and select New -> Business
Object Map.
d. In the Name field, enter CustomerBG_To_SapCust_WrapperBG_createOp,
and click Next.
e. Select CustomerBG as the input and SapCust_WrapperBG as the output,
and click Finish.
f. Wire the verb attribute from CustomerBG to the SapCust_WrapperBG’s verb
attribute as a Move.

37
g. Wire Customer to SapBapiCustomerCreatefromdata1 as a Submap.
h. In the Submap properties dialog, select the Details tab.
i. In the Business object map field, select the
Customer_To_SapBapiCustomerCreatefromdata1 submap.
j. Save the data map.

1. To create the CustomerBG_To_SapCust_WrapperBG_updateOp data map:


a. In SAPOutboundModule, right-click Data Maps, and select New -> Business
Object Map.
b. In the Name field, enter CustomerBG_To_SapCust_WrapperBG_updateOp,
and click Next.
c. Select CustomerBG as the input and SapCust_WrapperBG as the output,
and click Finish.
d. Wire the verb attribute from CustomerBG to the SapCust_WrapperBG’s verb
attribute as a Move.
e. Wire Customer to SapBapiCustomerChangefromdata1 as a Submap,
f. In the Submap properties dialog, select the Details tab.
g. In the Business object map field, select the
Customer_To_SapBapiCustomerChangefromdata1 submap.
h. Save the data map.

Unlike the CustomerDeliveryOneway interface in the Siebel inbound module, the


CustomerDeliveryRequestResponse interface in the SAP outbound module has to return a
business object to the service that invoked it. This means that you need to map the SAP-
specific business objects that are returned from create and update operations to generic
Customer business objects. You need to create the following maps:

• SapBapiCustomerCreatefromdata1_To_Customer
• SapBapiCustomerChangefromdata1_To_Customer
• SapCust_WrapperBG_To_CustomerBG_createOp
• SapCust_WrapperBG_To_CustomerBG_updateOp

2. To create the In SapBapiCustomerCreatefromdata1_To_Customer data map:


a. In SAPOutboundModule, right-click Data Maps, and select New -> Business
Object Map.
b. In the Name field, enter SapBapiCustomerCreatefromdata1_To_Customer,
and click Next.
c. Select SapBapiCustomerCreatefromdata1 as the input and Customer as the
output, and click Finish.
d. As before, you’ll notice that the SapBapiCustomerCreatefromdata1 business
object, you’ll notice that Customer has an array of Address child objects,
while SapBapiCustomerCreatefromdata1 has just one address per customer.
Because the current data map tools don’t allow you to pick an array element
from the Address array and map it to one SAP address, you need to edit the
map source file. To open the map source file, right-click on

38
SapBapiCustomerCreatefromdata1_To_Customer, and select Open With
-> Text Editor.
e. For each attribute in the Address object that you want to map, you need to
create an XML code segment. For example, if you want to map the city
attribute from the first Address business object in the Address array to
SapBapiCustomerCreatefromdata1’s city, you would add:
<map:propertyMap executionOrder="2">
<map:move>
<map:input
businessObjectVariableRef="SapBapiCustomerCreatefromd
ata1" property="SapPiPersonaldata1389002469/City"/>
<map:output businessObjectVariableRef="Customer"
property="address.0/city"/>
</map:move>
</map:propertyMap>
f. Note that property=”address.0/city” indicates the city attribute of the first
element (index 0) in the address array. The rest of the XML attributes and
elements are self-explanatory.
g. Join the Firstname and Lastname attributes of
Customer_To_SapBapiCustomerCreatefromdata1 to the name attribute of the
Customer business object.

Here is an example of the complete map source file:

<?xml version="1.0" encoding="UTF-8"?>


<map:businessObjectMap xmlns:Customer="http://CustomerSyncLibrary"
xmlns:SapBapiCustomerCreatefromdata1="http://www.ibm.com/xmlns/prod/web
sphere/j2ca/sap/sapbapicustomercreatefromdata1"
xmlns:SapBapiCustomerCreatefromdata1_To_Customer="http://SAPOutboundMod
ule"
xmlns:map="http://www.ibm.com/xmlns/prod/websphere/wbiserver/map/6.0.0"
targetNamespace="http://SAPOutboundModule">
<map:name>SapBapiCustomerCreatefromdata1_To_Customer</map:name>
<map:inputBusinessObjectVariable
businessObjectRef="SapBapiCustomerCreatefromdata1:SapBapiCustomerCreate
fromdata1" name="SapBapiCustomerCreatefromdata1"/>
<map:outputBusinessObjectVariable
businessObjectRef="Customer:Customer" name="Customer"/>
<map:propertyMap executionOrder="1">
<map:join>
<map:input
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/Firstname"/>
<map:input
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/Lastname"/>
<map:output businessObjectVariableRef="Customer" property="name"/>
</map:join>
</map:propertyMap>
<map:propertyMap executionOrder="2">
<map:move>

39
<map:input
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/City"/>
<map:output businessObjectVariableRef="Customer"
property="address.0/city"/>
</map:move>
</map:propertyMap>
<map:propertyMap executionOrder="3">
<map:move>
<map:input
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/PostlCod1"/>
<map:output businessObjectVariableRef="Customer"
property="address.0/postalCode"/>
</map:move>
</map:propertyMap>
<map:propertyMap executionOrder="4">
<map:move>
<map:input
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/Street"/>
<map:output businessObjectVariableRef="Customer"
property="address.0/address1"/>
</map:move>
</map:propertyMap>
<map:propertyMap executionOrder="5">
<map:move>
<map:input
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469/Country"/>
<map:output businessObjectVariableRef="Customer"
property="address.0/country"/>
</map:move>
</map:propertyMap>
</map:businessObjectMap>

40
Figure 38 shows the completed map in the map editor.

Figure 38. SapBapiCustomerCreatefromdata1_To_Customer

3. To create the SapBapiCustomerChangefromdata1_To_Customer, use the same steps


that you used to create the SapBapiCustomerChangefromdata1_To_Customer data
map, except the name of map is SapBapiCustomerChangefromdata1_To_Customer
and the input business object is SapBapiCustomerCreatefromdata1, instead of
SapBapiCustomerChangefromdata1. Map the attributes as shown in Figure 39.

Figure 39. SapBapiCustomerChangefromdata1_To_Customer data map

41
1. To create the SapCust_WrapperBG_To_CustomerBG_createOp:
g. In SAPOutboundModule, right-click Data Maps, and select New -> Business
Object Map.
h. In the Name field, enter SapCust_WrapperBG_To_CustomerBG_createOp,
and click Next.
i. Select SapCust_WrapperBG as the input and CustomerBG as the output,
and click Finish.
j. Wire the verb attribute from SapCust_WrapperBG to the CustomerBG’s verb
attribute as a Move.
k. Wire SapBapiCustomerCreatefromdata1 to Customer as a Submap.
l. In the Submap properties, click the Details tab.
m. In the Business object map field, select the
SapBapiCustomerCreatefromdata1_To_Customer submap.
n. Save the data map.

1. To create the SapCust_WrapperBG_To_CustomerBG_updateOp data map:


h. In SAPOutboundModule, right-click Data Maps, and select New -> Business
Object Map.
i. In the Name field, enter SapCust_WrapperBG_To_CustomerBG_updateOp,
and click Next.
j. Select SapCust_WrapperBG as the input and CustomerBG as the output,
and click Finish.
k. Wire the verb attribute from SapCust_WrapperBG to the CustomerBG’s verb
attribute as a Move.
l. Wire SapBapiCustomerChangefromdata1 to Customer as a Submap,
m. In the Submap properties, click the Details tab.
n. In the Business object map field, select the
SapBapiCustomerChangefromdata1_To_Customer submap.
o. Save the data map.

1. To create the CustomerDeliveryRequestRespond_To_SAPOutboundInterface


interface map:
a. In SAPOutboundModule, right-click Data Maps, and select New -> Business
Object Map.
b. In the Name field, enter
CustomerDeliveryRequestRespond_To_SAPOutboundInterface, then
click Next.
c. Select CustomerDeliveryRequestRespond as the source interface and
SAPOutboundInterface as the destination interface, then click Finish.
d. In the interface map editor, wire createBackendCustomer operation to the
createSapCust_Wrapper operation.
e. Select the connecting wire from above; the parameter mapping appears.
f. Wire CustomerBG to SapCust_WrapperBG and vice versa for the input and
return parameters, as shown in Figure 40.

42
Figure 40. Map createBackendCustomer to createSapCust_Wrapper

g. Change the parameter mapping type from move to map in the move
properties editor for both the input and return parameters.
h. On the Details tab of the input map properties, select
CustomerBG_To_SapCust_WrapperBG_createOp.
i. On the Details tab of the return map properties, select
SapCust_WrapperBG_To_CustomerBG_createOp.
j. Wire updateBackendCustomer to updatewithdeleteSapCust_Wrapper.
k. Select the connecting wire from the above step.
l. Repeat steps f and g.
m. On the Details tab of the input map properties, select
CustomerBG_To_SapCust_WrapperBG_updateOp.
n. On the Details tab of the return map properties, select
SapCust_WrapperBG_To_CustomerBG_updateOp. See Figure 41.

43
Figure 41. Map updateBackendCustomer to createSapCust_Wrapper

2. To complete the SAP outbound module:


a. Drag and drop the newly created interface map from the Business Integration
view to the SAP outbound module’s assembly diagram.
b. Wire CustomerDeliveryRequestRespond_To_SAPOutboundInterface to
SAPOutboundInterface.
c. Right-click CustomerDeliveryRequestRespond_To_SAPOutboundInterface,
and select Generate Export -> SCA binding to export the SAP outbound
service. When exporting this service, you can choose from the following bindings
• SCA binding
• Web Service binding
• JMS binding
• MQ binding
• MQ JMS binding
d. In our example, the BPEL module (residing on the same server) will invoke the
BPEL module. In this scenario, we’ll use Service Component Architecture (SCA)
binding. If the invoking service is on a distributed system, you could use a Web
service binding or another binding that is compatible with the client’s import
binding. Figure 42 shows the SAP outbound module.
e. Rename the export to SAPOutboundServiceExport.

44
Figure 42. SAP outbound module

Create a BPEL module


The BPEL module contains a very simple business process. The business process checks
for the verb of the incoming business graph. If the verb is create, it invokes the SAP
outbound module to create a customer in SAP. If the verb is update, it invokes the SAP
outbound module to update an existing customer in SAP. For any other verb, a message
is written to the console. To keep this scenario simple, no exception handling logic is
added to the business process. See Figure 43.

Figure 43. Business process flow chart


Receive
incoming
BG

What is the verb of the


Verb is create Verb is not create or update
incoming BG?

Verb is update

Invoke SAP Invoke SAP


Outbound Outbound Write incoming
Module’s create Module’s update event to console
operation operation

To create the data synchronization business process, do the following:


2. Right-click the Business Integration view and select New -> Module.
3. Enter BPELModule as the module name, and click Next.
4. Select CustomerSyncLibrary as the module’s dependent library, and click
Finish.
5. Right-click Business Logic, and select New -> Business Process.

45
6. Enter DataSyncProcess as the name of the business process, and click Next.
7. Click Select an existing Interface -> Browse, and select
CustomerDeliveryOneway, then click Next.
8. Click Finish.

To create a new DataSyncProcess business process, complete the following steps:


1. Open the newly created DataSyncProcess business process.
2. In the business process editor, click the Choice icon from the palette on the left.
3. Place the choice under Receive.
4. Rename the choice to Check_Verb.
5. Hover over the choice and click Add Case to add a new case.
6. Rename the two cases to create and update.
7. Select and hover over the Check_Verb choice and add an otherwise case.
8. Select Invoke from the palette.
9. Place Invoke under the create case.
10. Rename Invoke to CreateBackendCustomer.
11. Select Invoke again from the palette.
12. Place Invoke under the update case.
13. Rename Invoke to UpdateBackendCustomer,
14. To invoke the SAP outbound service, you eed to create a reference partner. On
the right side of editor, click the Add Reference Partner (+) icon.
15. In the properties view, change the reference interface to
CustomerDeliveryRequestResponse.
16. Select CreateBackendCustomer.
17. In the Properties view, click the Details tab.
18. Set the Partner to BackendPartner.
19. Set the Operation to createBackendCustomer.
20. Set the variable for Input to InputCustomerBG.
21. Click on the … button on the Outputs row, and click New.
22. Enter returnCustomerBG, and click OK.
23. Click OK to set ReturnCustomerBG as the Output variable.
24. Select UpdateBackendCustomer.
25. Repeat steps q through x, except the Operation is updateBackendCustomer and
you don’t need to create ReturnCustomerBG, as it was already created.
26. To route data flow in the choice, you need to add code to the create and update
cases. Select the create case.
27. In the properties view, select Details tab.
28. Select Java as the Expression language.
29. Delete the link between the true and return expression.
30. Insert a standard text equal to (ignore case) snippet.
31. Change the true express to InputCustomerBG.verb.
32. Click x+y in the palette to add an expression to the editor.
33. Click on the new expression and set it to a string with value equal to create.
34. Wire the expressions and snippets as shown in Figure 44.

46
Figure 44. Visual snippet for create case

35. Select the update case.


36. Repeat steps 28 to 33. In step 33, instead of setting the expression to create, set it
to update.
37. From the palette, select the snippet icon and place it under otherwise.
38. Rename the snippet to outputToConsole.
39. On the properties view Details tab, click x+y to add an expression.
40. Set the expression value to InputCustomerBG.Customer.name.
41. Add a print to log standard snippet.
42. Wire the InputCustomerBG.Customer.name expression to the print to log
standard snippet as shown in Figure 45. This will write the name of the customer
to the console if the verb is not create or update.

Figure 45. Output to log snippet

Siebel adapter uses the verb update to represent update events. However, the SAP
adapter does not have an update verb. It uses an UpdateWithDelete verb to represent
updates. Therefore, you need to change the update verb to UpdateWithDelete in
CustomerBG before sending it to SAP for update events. You can do this conversion in
the SAP interface mediation and data mapping or handle it in the BPEL process. Follow
these steps to convert the update verb in the incoming CustomerBG:

1. From the business process editor, click the Assign icon in the palette and place it
under the update case.
2. Rename the Assign to UpdateWithDelete_Verb.
3. In the properties view Details tab, select Fixed Value in the From field.

47
4. Enter UpdateWithDelete under the From field.
5. Select Variable in the To field.
6. Under InputCustomerBG, select verb: Restriction of string, as shown in Figure
46.

Figure 46. Assign UpdateWithDelete verb

The completed data synchronization business process is shown in Figure 47.

Figure 47. Data synchronization business process

Complete the BPEL module in the assembly diagram by doing the following:
1. Drag and drop DataSyncProcess in the BPEL module to the BPEL module’s
assembly diagram.

48
2. Right-click DataSyncProcess in the assembly diagram, and select Generate
Export -> SCA binding to export the data synchronization process service.
3. Rename the export component to BPELProcessExport.
4. DataSyncProcess uses the SAP outbound module as its reference partner. This
means DataSyncProcess invokes services provided in the SAP outbound module.
In the business integration view, drag and drop SAPOutboundServiceExport
under SAPOutboundModule’s assembly diagram into BPELModule’s assembly
diagram.
5. Select import with SCA binding, and click OK.
6. Rename the newly created import component to SAPOutboundServiceImport.
7. Wire DataSyncProcess to SAPOutboundServiceImport. See the generated export
component in Figure 48.

Figure 48. BPEL module

To complete the Siebel inbound module in the Siebel inbound assembly diagram, import
DataSyncProcess from the Siebel inbound module as follows:
1. Open the Siebel inbound module’s assembly diagram.
2. In the business integration view, drag and drop BPELProcessExport (under BPEL
module) into the Siebel inbound module’s assembly diagram.
3. Select import with SCA binding, and click OK.
4. Rename the newly created import component to BPELServiceImport
5. Wire SiebelInboundInterface_To_CustomerDeliveryOneway to
BPELServiceImport as shown in Figure 49.

Figure 49. Siebel inbound module

49
Configure relationships
Data that has the same semantic meaning to the integration developer is often stored in
different formats and values in different Enterprise Information Systems. For example,
the primary key property for IBM Account in Siebel has a different format and value than
the primary key property for the corresponding IBM Customer in SAP, even though they
refer to the same customer (IBM). In another example, the country property in Siebel
uses USA to represent the United States, but the country property in SAP uses US.

In your data maps, you can’t simply move these fields from the source business object to
the destination business object for this type of data. Instead, you need to create and
maintain a cross-reference to correlate them across the different enterprise systems
Process Server provides a relationship service to automate correlation of properties at
runtime. There are two types of relationships: dynamic and static.

Configure dynamic relationships


We’ll use dynamic relationship to correlate the primary keys between Siebel Account and
SAP Customer. The primary keys generated by Siebel and SAP are dynamically
mapped.

The life cycle of a dynamic relationship starts with the Siebel inbound business graph.
When the incoming business graph arrives at the Siebel mediation component, the
relationship looks at the verb of the business graph. If the verb is create, the relationship
then looks at the relationship table to see if an entry already exists that contains the key of
the incoming business object. If one already exists, it throws an exception. If not, a new
entry is created with the Siebel business object key and a generic key. The generic
integer key is assigned to the generic Customer business object’s ID field. The Customer
business object passes through the business process component into the SAP mediation
component. The generic Customer business object is transformed to a SAP-specific
business object. Since you’re performing a create operation, the SAP-specific business
object’s primary key field is left blank. The SAP-specific business object arrives at the
SAP adapter. The SAP adapter invokes createSapCust_Wrapper to create a new
customer on SAP. If the create operation was successful, a SAP-specific business object
is returned along with the primary key of the newly created customer. This business
object travels to the SAP mediation component where the relationship writes the SAP
customer key and the generic key to the relationship table. See Figure 50.

50
Figure 50. Relationship service
Relationship Relationship

Map Map
Siebel SAP

Mediation Business Mediation


Siebel Adapter SAP Adapter
Component Process Component

If an Account is updated on Siebel, a Siebel Account business graph is sent by the Siebel
adapter to the Siebel mediation component. The relationship checks the verb. Since the
verb is update, the relationship looks up the relationship table to cross-reference the
generic key. If not found, it throws an exception. Otherwise, it places the generic key in
the Customer business object’s ID field. The Customer business object passes through
the business process component and arrives at the SAP mediation component. The
relationship cross-references the corresponding SAP customer key based on the generic
Customer business object’s ID. It then places the SAP customer key in the SAP-specific
business object. The SAP adapter uses this key to update the corresponding SAP
customer in its database.

Relationships consists of definitions and roles. Follow these steps to create the necessary
relationship definitions and roles:
1. In the business integration view, right-click Relationships under
CustomerSyncLibrary -> Mapping, and select New -> Relationship.
2. Enter CustomerREL for the relationship name.
3. Select A one-to-one relationship between business objects using the unique
primary key, and click Finish.
4. Click Add Role, and select Customer.
5. Click Add Role, and select IOAccountInterfaceICAccount.
6. Click Add Role, and select SapBapiCustomerCreatefromdata1.
7. Select CustomerREL_Customer, and click Add Key Attribute.
8. Select id as the key attribute.
9. Select CustomerREL_IOAccountInterfaceICAccount, and click Add Key
Attribute.
10. Select AccountId as the key attribute.
11. Select CustomerREL_SapBapiCustomerCreatefromdata1, and click Add Key
Attribute.
12. Select Customerno as the key attribute.
13. Select CustomerREL_Customer.
14. On the properties view Details tab check Managed.

In our example, we use the SAP BAPI interface to interact with SAP.
BAPI_CUSTOMER_CREATEFROMDATA1 is used to create a new SAP customer,
while BAPI_CUSTOMER_CHANGEFROMDATA1 is used to update a SAP customer.

51
Unlike the Siebel Account business service, where a single Siebel
IOAccountInterfaceICAccount business object is use for both create and update
operations, in SAP you need to use the SapBapiCustomerCreatefromdata1 business
object for the create operation and the SapBapiCustomerChangefromdata business object
for the update operation. Each of these SAP business objects has its own customer key
field. This is a problem, as it doesn’t fit into the relationship model which expects a
relationship role to have duplicated key fields. Figure 51 shows that there is one
Customerno field in each of the SapCust_Wrapper children.

Figure 51. SapCust_Wrapper business object

To overcome this problem, we’ll use SapBapiCustomerCreatefromdata1 as a relationship


role. Now you need to synchronize the Customerno field in
SapBapiCustomerCreatefromdata1 to the Customerno field in
SapBapiCustomerChangefromdata1 in our data map. To do that complete the following
steps:

1. Update Siebel inbound module mediation component as follows:


b. Open the IOAccountInterfaceICAccount_To_Customer data map in Siebel
inbound module.
c. Wire IOAccountInterfaceICAccount to Customer.
d. Change the connection type from Submap to Relationship.
e. In the properties view for the relationship, click the Description tab and set
execution order to 1.
f. Click the Details tab.
g. Select the CustomerREL relationship definition.
h. Select the CustomerREL_IOAccountInterfaceICAccount relationship role.

1. Update the SAP outbound module mediation component for the create operation
(request) as follows:
c. Open CustomerBG_To_SapCust_WrapperBG_createOp data map
d. Wire Customer to SapBapiCustomerCreatefromdata1 as a relationship
e. In the properties view for the relationship select Details tab
f. Select CustomerREL as the relationship definition

52
g. Select CustomerREL_SapBapiCustomerCreatefromdata1 as the
relationship role

1. Update the SAP outbound module mediation component for the create operation
(response) as follows:
a. Open SapCust_WrapperBG_To_CustomerBG_createOp data map
b. Wire SapBapiCustomerCreatefromdata1 to Customer
c. In the properties view for the relationship select Details tab
d. Select CustomerREL as the relationship definition
e. Select CustomerREL_SapBapiCustomerCreatefromdata1 as the
relationship role

1. Update the SAP outbound module mediation component for the update operation
(request) as follows:
a. Open CustomerBG_To_SapCust_WrapperBG_updateOp data map
b. Wire Customer to SapBapiCustomerCreatefromdata1 as a relationship
c. In the properties view for the relationship select Details tab
d. Select CustomerREL as the relationship definition
e. Select CustomerREL_SapBapiCustomerCreatefromdata1 as the
relationship role

1. In addition to relationship wiring, you also need to synchronize the Customerno field
from SapBapiCustomerCreatefromdata1 to SapBapiCustomerChangefromdata1’s
Customerno field. This is to overcome the problem mentioned earlier.
a. Click Add a variable to add a variable to the map.
b. Rename the new variable to tempCustomerID,
c. Add a Custom Assign to the
SapBapiCustomerCreatefromdata1/Customerno field.
d. In the properties view for Custom Assign, click the Details tab.
e. Select Java radio button, then click Yes to the prompt.
f. Add this line to the Java editor: tempCustomerID =
(String)SapCust_WrapperBG_SapCust_Wrapper_SapBapiCustomerCreat
efromdata1_Customerno;
g. Add another Custom Assign to the
SapBapiCustomerChangefromdata1/Customerno field.
h. In the properties view for Custom Assign, select the Details tab.
i. Select Java radio button, then click Yes to the prompt.
j. Add this line to the Java editor:
SapCust_WrapperBG_SapCust_Wrapper_SapBapiCustomerChangefromdat
a1_Customerno = tempCustomerID;
k. Save the data map. Figure 52 shows the completed map.

53
Figure 52. CustomerBG_To_SapCust_WrapperBG_updateOp

1. Update the SAP outbound module mediation component for the update operation
(response) as follows:
a. Open the SapCust_WrapperBG_To_CustomerBG_updateOp data map.
b. Wire SapBapiCustomerCreatefromdata1 to Customer as a relationship.
c. In the properties view for the relationship, click the Details tab.
d. Select CustomerREL as the relationship definition.
e. Select CustomerREL_SapBapiCustomerCreatefromdata1 as the
relationship role.

2. As in Step 5, you need to synchronize the Customerno field from


SapBapiCustomerChangefromdata1 to the SapBapiCustomerCreatefromdata1’s
Customerno field.
a. Click Add a variable to add a variable to the map.
b. Rename the new variable to tempCustomerID.
c. Add a Custom Callout to the
SapBapiCustomerChangefromdata1/Customerno field.
d. In the properties view for Custom Callout, click the Details tab.
e. Select Java, then click Yes to the prompt
f. Add this line to the Java editor: tempCustomerID =
(String)SapCust_WrapperBG_SapCust_Wrapper_SapBapiCustomerChang
efromdata1_Customerno;
g. Add a Custom Callout to SapBapiCustomerCreatefromdata1/Customerno
field

54
h. In the properties view for Custom Callout, select the Details tab
i. Select Java radio button then click Yes to the prompt.
j. Add this line to the Java editor:
SapCust_WrapperBG_SapCust_Wrapper_SapBapiCustomerCreatefromdat
a1_Customerno = tempCustomerID;
k. In the properties view for the relationship, change the execution order to 5.
l. Save the data map. Figure 53 shows the completed map.

Figure 53. SapCust_WrapperBG_To_CustomerBG_updateOp

Configure static relationships


SAP and Siebel use different formats and values to represent static data that is
semantically equivalent. For example, Siebel Account uses USA in its country field to
represent the United States while SAP Customer uses US. Static data such as country
and state rarely change over time. In your data maps, you can’t simply move USA from
the Siebel business object’s country field over to the SAP business object’s country
field. However, Process Server provides a relationship designer that allows you to define
static relationships, create relationship roles, and populate static relationship instances (in
a look-up table). At runtime, you can invoke relationship service APIs to look up
matching values in these predefined relationship instances.

For the generic Customer business object, you need to define non-application specific
data for the country field (you can choose any value you like). Table 2 shows a sample
mapping of Siebel-specific country data to the generic country data in the Customer
business object.

Table 2. Map Siebel country to generic country


Siebel-specific data Generic data
Australia DownUnder
USA America
Spain Hispania

55
Japan Nippon
Jamaica Jamdown

Table 3 shows a sample mapping of the Customer business object’s country data to SAP-
specific country data.

Table 3. Map generic country to SAP country


Generic data SAP-specific
DownUnder AU
America US
Hispania ES
Nippon JP
Jamdown JM

Like with dynamic relationships, you can create a static relationship in the library. This
relationship would have three relationship roles that correspond to the business objects in
the three modules. You can then define the static relationship instance data in this
relationship. However, the relationship designer currently has a limitation in which only
business objects defined in the library (or in the module, if the relationship was created in
the module) are visible to the static relationship. In other words, business object visibility
in a static relationship does not span different modules.

To overcome this limitation, you need to create two static relationships, one in the
Siebel inbound module and the other in the SAP outbound module. The static
relationship in the Siebel inbound module maps the Siebel-specific country field to the
Customer business object’s country field. The static relationship in the SAP outbound
module maps the Customer business object’s country field to SAP-specific country
field. Even though the Customer business object is not defined in the Siebel inbound
module or the SAP outbound module, these modules have a dependency on the library
where Customer is defined. Therefore, the Customer business object is visible in both the
Siebel inbound module and the SAP outbound module.

You can also create static mapping for the state or other fields that have static data.
However, in this article we’ll just map the country field to illustrate the concept of static
relationship mapping.

Create a static relationship in the Siebel inbound module


1. Right-click on SiebelInboundModule, and select New -> Relationship.
2. Enter CountryREL as the name of the relationship, and click Next.
3. Select one to one, one-to-many or many-to-many relationship between
business objects using any attribute, and check static mapping as shown in
Figure 54, then click Finish.

56
Figure 54. Select static relationship mapping

4. Click Add Role, and select IOAccountInterfaceICBusinessAddress, then click


OK.
5. Click Add KeyAttribute, and select Country, then click OK.
6. Click Add Role, and select Address, then click OK.
7. Click Add KeyAttribute, and select Country, then click OK.
8. Select CountryREL,
9. In the properties view, click the Instance Data tab, and enter the instance data as
shown in Figure 55.

57
Figure 55. Populate static instance data

10. Select a correlation ID of 1.


11. Click Add to add a correlation ID of 2.
12. Enter the values from row 2 of Table 2 above into the second correlation.
13. Repeat Step 12 to enter each of the entries in Table 2. The final instance data
editor is shown in Figure 56.

Figure 56. Static instance data

14. Save the static relationship.


15. Open the IOAccountInterfaceICBusinessAddress_To_Address data map.
16. Wire IOAccountInterfaceICBusinessAddress to Address (the top row).
17. Change the mapping from Submap to Custom.
18. Select Custom.
19. In the properties view, click the Java Imports tab.

58
20. Paste the following import statements into the editor:
import com.ibm.websphere.sca.ServiceManager;
import com.ibm.wbiserver.rel.RelationshipService;
import java.util.List;
import commonj.sdo.DataObject;

21. Click the Details tab.


22. Select Java and paste the following Java snippet into the editor:

try {
ServiceManager serviceManager = new ServiceManager();
RelationshipService relationshipService = (RelationshipService)

serviceManager.locateService("com/ibm/wbiserver/rel/RelationshipService"
);

//Based on the value of incoming Siebel country the corresponding


instance id is returned
int[] correlationID = relationshipService.
retrieveInstanceIDs("http://SiebelInboundModule/CountryREL",
"http://SiebelInboundModule/SiebelBO/CountryREL_IOAccountIn
terfaceICBusinessAddress",
IOAccountInterfaceICBusinessAddress);

//For a given instance id, the participating Address BO is


returned

List participants = relationshipService.

retrieveParticipants("http://SiebelInboundModule/CountryREL",
"http://SiebelInboundModule/CountryREL_Address",
correlationID[0]);

//Get the corresponding country value from the participating


Address BO
DataObject gboAddress = (DataObject) participants.get(0);
String country = (String) gboAddress.get("country");

//Set the current map's destination Address BO with the


corresponding country value
Address.set("country", country);

} catch (RuntimeException e) {
e.printStackTrace();
}

Create a static relationship in the SAP outbound module


The static relationship in the SAP outbound module is more complex than the static
relationship in the Siebel inbound module. In the SAP outbound module, you need to
create a static mapping for request operations as well for response operations. If you look
at the SAP business object definition for create and update operations, you’ll notice that

59
there are separate child business objects that hold address information. For a create
operation, the child SAP business object that contains the address information is
SapPiPersonaldata1389002469. For update operations, the child SAP business object
that contains the address information is SapPiPersonaldata1. The static relationship
contains three roles:
o Address business object
o SapPiPersonaldata1389002469
o SapPiPersonaldata1
To complete the static mapping in SAP outbound module, you’ll need to complete the
following tasks:

• Map the country field from the Address business object to the country field in
SapPiPersonaldata1389002469 for the create operation (request portion).
• Map the country field from the Address business object to the country field in
SapPiPersonaldata1 for the update operation (request portion).
• Map the country field from SapPiPersonaldata1389002469 to the country field
in the Address business object for the creation operation (response portion).
• Map the country field from the SapPiPersonaldata1 business object to the
country field in the Address business object for the update operation (response
portion).

Create a static relationship


To create a static relationship, complete the following steps:
1. Right-click SAPOutboundModule, and select New -> Relationship.
2. Enter CountryREL as the name of the relationship, and click Next.
3. Select one-to-one, one-to-many, many-to-many relationship and static
mapping as shown in Figure 51, then click Finish.
4. Click Add Role, select Address, and click OK.
5. Click Add KeyAttribute, select country, and click OK.
6. Click Add Role, select SapPiPersonaldata1389002469, and click OK.
7. Click Add KeyAttribute, select Country, and click OK.
8. Click Add Role, select SapPiPersonaldata, and click OK.
9. Click Add KeyAttribute, select Country, and click OK.
10. Select CountryREL.
11. In the properties view, click the Instance Data tab.
12. Enter the instance data as shown in Figure 57.

60
Figure 57. Populate static instance data

13. Select a correlation ID of 1.


14. Click Add to add a correlation ID of 2.
15. Enter the values from row 2 of Table 3 above into the second correlation.
16. Repeat Step 15 to add the rest of the entries in Table 3. The final instance data
editor is shown in Figure 58.

61
Figure 58. Static instance data

17. Save the static relationship.

Map the country field for the create operation (request portion)
1. Create new data map called Address_To_SapPiPersonaldata_createOp.
2. When creating the new map, select the Address business object as the source and
SapPiPersonaldata1389002469 business object as the destination.
3. Wire Address to SapPiPersonaldata1389002469 as Custom, as shown in Figure
59.

Figure 59. Use Custom mapping between the two business objects

4. Select Custom.
5. In the properties view, click the Java Import tab.
6. Paste the following import statements into the editor:
import com.ibm.websphere.sca.ServiceManager;
import com.ibm.wbiserver.rel.RelationshipService;
import java.util.List;

62
import commonj.sdo.DataObject;

7. Select the Details tab.


8. Select Java and paste the following Java snippet into the editor:

try {
ServiceManager serviceManager = new ServiceManager();
RelationshipService relationshipService = (RelationshipService)

serviceManager.locateService("com/ibm/wbiserver/rel/RelationshipService"
);

//Based on the value of incoming Address/country the


corresponding instance id is returned
//Parameter for retrieveInstanceIDs method are
//(relationshipName, AddressRole, AddressBO)
int[] correlationID = relationshipService.
retrieveInstanceIDs("http://SAPOutboundModule/CountryREL",
"http://SAPOutboundModule/CountryREL_Address",
Address);

//For a given instance id, the participating SAP BO is returned


//Parameters for retrieveParticipants method are
//(relationshipName, SapPiPersonaldata1389002469BO,
correlationId)

List participants = relationshipService.


retrieveParticipants("http://SAPOutboundModule/CountryREL",
"http://SAPOutboundModule/SAPBO/CountryREL_SapPiPersonaldat
a1389002469", correlationID[0]);

//Get the corresponding country value from the participating SAP


BO
DataObject sapAddress = (DataObject) participants.get(0);
String country = (String) sapAddress.get("Country");

//Set the current map's destination SAP BO with the corresponding


country value
SapPiPersonaldata1389002469.set("Country", country);

} catch (RuntimeException e) {
e.printStackTrace();
}

Map the country field for the update operation (request portion)
1. Create a new data map called Address_To_SapPiPersonaldata_updateOp.
2. When creating the new map, select Address as the source and
SapPiPersonaldata as the destination.
3. Wire Address to SapPiPersonaldata as Custom.
4. Select Custom.
5. In the properties view, click the Java Import tab.
6. Paste the following import statements into the editor:

63
import com.ibm.websphere.sca.ServiceManager;
import com.ibm.wbiserver.rel.RelationshipService;
import java.util.List;
import commonj.sdo.DataObject;

7. Click the Details tab.


8. Select Java and paste the following Java snippet into the editor:
try {
ServiceManager serviceManager = new ServiceManager();
RelationshipService relationshipService = (RelationshipService)

serviceManager.locateService("com/ibm/wbiserver/rel/RelationshipService"
);

//Based on the value of incoming Address/country the


corresponding instance id is returned
int[] correlationID = relationshipService.
retrieveInstanceIDs("http://SAPOutboundModule/CountryREL",
"http://SAPOutboundModule/CountryREL_Address",
Address);

//For a given instance id, the participating SAP BO is returned

List participants = relationshipService.


retrieveParticipants("http://SAPOutboundModule/CountryREL",
"http://SAPOutboundModule/SAPBO/CountryREL_SapPiPersonaldat
a", correlationID[0]);

//Get the corresponding country value from the participating SAP


BO
DataObject sapAddress = (DataObject) participants.get(0);
String country = (String) sapAddress.get("Country");

//Set the current map's destination SAP BO with the corresponding


country value
SapPiPersonaldata.set("Country", country);

} catch (RuntimeException e) {
e.printStackTrace();
}

Map the country field for the create operation (response portion)
1. Create a new data map called
SapPiPersonaldata_To_Address_createOp.
2. When creating the new map, select SapPiPersonaldata1389002469 as the source
and Address as the destination.
3. Wire SapPiPersonaldata1389002469 to Address as Custom.
4. Select Custom.
5. In the properties view, click the Java Import tab.
6. Paste the following import statements into the editor:
import com.ibm.websphere.sca.ServiceManager;
import com.ibm.wbiserver.rel.RelationshipService;

64
import java.util.List;
import commonj.sdo.DataObject;

7. Click the Details tab.


8. Select Java and paste the following Java snippet into the editor:
try {
ServiceManager serviceManager = new ServiceManager();
RelationshipService relationshipService = (RelationshipService)

serviceManager.locateService("com/ibm/wbiserver/rel/RelationshipService"
);

//Based on the value of incoming SAP country the corresponding


instance id is returned
int[] correlationID = relationshipService.
retrieveInstanceIDs("http://SAPOutboundModule/CountryREL",
"http://SAPOutboundModule/SAPBO/CountryREL_SapPiPersonaldat
a1389002469",
SapPiPersonaldata1389002469);

//For a given instance id, the participating Address BO is


returned

List participants = relationshipService.


retrieveParticipants("http://SAPOutboundModule/CountryREL",
"http://SAPOutboundModule/CountryREL_Address",
correlationID[0]);

//Get the corresponding country value from the participating


Address BO
DataObject gboAddress = (DataObject) participants.get(0);
String country = (String) gboAddress.get("country");

//Set the current map's destination Address BO with the


corresponding country value
Address.set("country", country);

} catch (RuntimeException e) {
e.printStackTrace();
}

Map the country field for the update operation (response portion)
1. Create a new data map called SapPiPersonaldata_To_Address_updateOp.
2. When creating the new map, select SapPiPersonaldata as the source and Address
as the destination.
3. Wire SapPiPersonaldata to Address as Custom.
4. Select Custom.
5. In the properties view, click the Java Import tab.
6. Paste the following import statements into the editor:
import com.ibm.websphere.sca.ServiceManager;
import com.ibm.wbiserver.rel.RelationshipService;
import java.util.List;

65
import commonj.sdo.DataObject;

7. Click the Details tab.


8. Select Java and paste the following Java snippet into the editor:

try {
ServiceManager serviceManager = new ServiceManager();
RelationshipService relationshipService = (RelationshipService)

serviceManager.locateService("com/ibm/wbiserver/rel/RelationshipService"
);

//Based on the value of incoming SAP country the corresponding


instance id is returned
int[] correlationID = relationshipService.
retrieveInstanceIDs("http://SAPOutboundModule/CountryREL",
"http://SAPOutboundModule/SAPBO/CountryREL_SapPiPersonaldat
a",
SapPiPersonaldata);

//For a given instance id, the participating Address BO is


returned

List participants = relationshipService.


retrieveParticipants("http://SAPOutboundModule/CountryREL",
"http://SAPOutboundModule/CountryREL_Address",
correlationID[0]);

//Get the corresponding country value from the participating


Address BO
DataObject gboAddress = (DataObject) participants.get(0);
String country = (String) gboAddress.get("country");

//Set the current map's destination Address BO with the


corresponding country value
Address.set("country", country);

} catch (RuntimeException e) {
e.printStackTrace();
}

Complete the static mapping


Now that you’ve created the four sub maps, you need to add them to the parent maps to
complete the static mapping by completing the following steps:
1. Open the Customer_To_SapBapiCustomerCreatefromdata1 data map.
2. Wire Address to SapPiPersonaldata1389002469 as shown in Figure 60.

66
67
Figure 60. Map Address to SapPiPersonaldata1389002469

3. In the properties view for the new submap link, select Details.
4. In Business object map field, select the Address_To_
SapPiPersonaldata_createOp submap.
5. Close the data map.
6. Reopen the data map using a text editor to view the source.
7. Scroll to bottom of the file and add .0 for the address property, as shown below,
to indicate mapping from the first element of the address array to
SapPiPersonaldata1389002469.
<map:propertyMap executionOrder="13">
<map:submap
submapName="Customer_To_SapBapiCustomerCreatefromdata1:Address_To
_SapPiPersonaldata_createOp">
<map:input businessObjectVariableRef="Customer"
property="address.0" variableName="Address"/>
<map:output
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469"
variableName="SapPiPersonaldata1389002469"/>
</map:submap>
</map:propertyMap>
8. Open the Customer_To_SapBapiCustomerChangefromdata1 data map.
9. Wire Address to SapPiPersonaldata as shown in Figure 61.

Figure 61. Map Address to SapPiPersonaldata

10. In the properties view for the new submap link, select Details.

68
11. In Business object map field, select the Address_To_
SapPiPersonaldata_upateOp submap.
12. Close the data map.
13. Reopen the data map using a text editor to view the source.
14. Scroll to bottom of the file and add a .0 for the address property, as shown below,
to indicate mapping from the first element of the address array to
SapPiPersonaldata.
<map:propertyMap executionOrder="16">
<map:submap
submapName="Customer_To_SapBapiCustomerChangefromdata1:Address_To
_SapPiPersonaldata_updateOp">
<map:input businessObjectVariableRef="Customer"
property="address.0" variableName="Address"/>
<map:output
businessObjectVariableRef="SapBapiCustomerChangefromdata1"
property="SapPiPersonaldata" variableName="SapPiPersonaldata"/>
</map:submap>
</map:propertyMap>

15. Open the SapBapiCustomerCreatefromdata1_To_Customer data map.


16. Wire SapPiPersonaldata1389002469 to Address as shown in Figure 62.

Figure 62. Map SapPiPersonaldata1389002469 to Address

17. In the properties view for the new submap link, select Details.
18. In the Business object map field, select the
SapPiPersonaldata_To_Address_createOp submap.
19. Close the data map.
20. Reopen the data map using a text editor to view the source.
21. Scroll to bottom of the file and add a .0 for the address property, as shown below,
to indicate mapping from the first element of the address array to
SapPiPersonaldata1389002469.
<map:propertyMap executionOrder="6">
<map:submap
submapName="SapBapiCustomerCreatefromdata1_To_Customer:SapPiPerso
naldata_To_Address_createOp">
<map:input
businessObjectVariableRef="SapBapiCustomerCreatefromdata1"
property="SapPiPersonaldata1389002469"
variableName="SapPiPersonaldata1389002469"/>

69
<map:output businessObjectVariableRef="Customer"
property="address.0" variableName="Address"/>
</map:submap>
</map:propertyMap>

22. Open the SapBapiCustomerChangefromdata1_To_Customer data map.


23. Wire SapPiPersonaldata to Address as shown in Figure 63.

Figure 63. Map SapPiPersonaldata to Address

24. In the properties view for the new submap link, select Details.
25. In the Business object map field, select the
SapPiPersonaldata_To_Address_updateOp submap.
26. Close the data map.
27. Reopen the data map using a text editor to view the source.
28. Scroll to bottom of the file and add a .0 for address property, as shown below, to
indicate mapping from the first element of the address array to SapPiPersonaldata.
<map:propertyMap executionOrder="6">
<map:submap
submapName="SapBapiCustomerChangefromdata1_To_Customer:SapPiPerso
naldata_To_Address_updateOP">
<map:input
businessObjectVariableRef="SapBapiCustomerChangefromdata1"
property="SapPiPersonaldata" variableName="SapPiPersonaldata"/>
<map:output businessObjectVariableRef="Customer"
property="address.0" variableName="Address"/>
</map:submap>
</map:propertyMap>

Configure event sequencing


When accounts are created or updated in Siebel, corresponding event entries are written
to the Siebel event table in the order in which they were created (see the Siebel adapter
documentation for more on how to create event tables in Siebel). The Siebel adapter
polls the event table at regular intervals to detect and retrieve events. The events are
retrieved according to the order of the entries in the event table. For example, the create
event for an account is listed before the update event of the same account. The Siebel
adapter retrieves the create event before the update event.

70
The events in the form of business objects are delivered to Process Server. Adapters can
deliver events to the Service Integration Bus destinations on Process Server
synchronously or asynchronously. Selecting asynchronous delivery mode greatly
enhances system performance. For asynchronous invocations, multiple instances of
message-driven beans (MDBs) read the messages, or events, and process them in parallel,
as shown in Figure 64.

Certain events may get processed before others. For example, when a create event
arrives at the relationship, its life cycle does not end until a customer is created in SAP
and the customer number is returned to the relationship. This can take some time to
complete. In the mean time, an update may be made to the same Siebel account and the
update event may arrive at the relationship. In this case, the relationship will throw an
exception because the create event has not yet been completed.

Figure 64. Adapter asynchronously delivers events to endpoint component

MDBs
Endpoint
Adapter
Component

create
update1
update2

Service Integration
Bus Destination

Figure 64 shows that the adapter places create, update1, and update2 events into the
Service Integration Bus destination. Multiple instances of MDBs process the events in
parallel.

Process Server Version 6.0.2 provides event sequencing capabilities that allow you to
configure event sequencing for selected events. Process Server enforces event
sequencing by requiring an event to acquire a lock before it is sent to the target
component for processing. If an event successfully acquires a lock, it is sent to the target
component for execution. When execution is complete, the event lock is released. If an
event cannot acquire a lock, the execution of the invocation is suspended until a lock is
available. When a lock is free and it acquires the lock, the event is sent to the target
component for processing. You can choose the component that requires event
sequencing. Typically, you would select the first component wired from the adapter
export component.

You specify event sequencing using quality of service qualifiers in the selected
component. You configure the quality of service qualifier to specify one or more

71
operations needing to be sequenced into groups. The sequencing is based on an event
sequencing key. The key can be made up of one or more business object attributes from
the operation parameters. The event sequencing runtime sequences events with the same
key. If a component uses a one-way interface, then the next component wired to it must
also be configured for event sequencing. If the component has a request respond
interface, the following components do not need to be configured for event sequencing.

In Figure 65 components A, B and C all have one-way interfaces and component A is


invoked asynchronously by the adapter. If you want to preserve event sequence, you
need to specify the event sequencing qualifiers on components A, B and C.

Figure 65. Configure event sequencing for component with one-way interface
ES ES ES
Adapter
Export Component A Component B Component C
(inbound)

Figure 66 shows how the adapter asynchronously invokes component A using a one-way
interface. You need to specify an event sequencing qualifier for component A.
However, component B and C are invoked by request response interfaces, so no event
sequencing qualifiers are needed for those components.

Figure 66. Configure event sequencing for component with request response interface
ES
Adapter
Export Component A Component B Component C
(inbound)

For our Siebel to SAP data synchronization scenario, you need to specify event
sequencing qualifiers for create and update events at the
SiebelInboundInterfact_To_CustomerInterface interface mediation component and the
DataSyncProcess component, as shown in Figure 67.

Figure 67. Configure event qualifiers


ES ES
Siebel Siebel SAP
Business SAP Adapter
Adapter Mediation mediation
process Import
Export component component

Specify an event sequencing qualifier for the Siebel mediation


component
Follow these steps:
1. Open the Siebel inbound module’s assembly diagram.
2. Select SiebelInboundInterfact_To_CustomerInterface.

72
3. In the properties view, click the Details tab, then click the Qualifiers tab in the
right pane.
4. Select emitCreateAfterImageIOAccountInterfaceICAccount under
SiebelInboundInterface.
5. Click Add.
6. Select Event Sequencing, and click OK.
7. Select emitCreateAfterImageIOAccountInterfaceICAccount again.
8. Select Event sequencing in the upper right pane.
9. In the lower right pane, change the group name to group1. Events are sequenced
on this group name and the account ID.
10. Add XPath to /IOAccountInterfaceICAccount/AccountId, as shown in Figure
68.

Figure 68. Specify event sequencing for Siebel mediation component

11. Select emitUpdateAfterImageIOAccountInterfaceICAccount under


SiebelInboundInterface.
12. Repeat steps 5 to 10.

Specify an event sequencing qualifier for DataSyncProcess


Follow these steps:
1. Open the BPEL module’s assembly diagram.
2. Select DateSyncProcess.
3. In the properties view, click the Details tab, then select the Qualifiers tab in the
right pane.
4. Select processCustomer under CustomerDeliveryOneway.
5. Click Add.
6. Select Event Sequencing, and click OK.
7. Select processCustomer again.
8. Select Event sequencing in the upper right pane.
9. In the lower right pane, change the group name to group1. Events are sequenced
on this group name and the customer ID.
10. Add XPath to /Customer/Id, as shown in Figure 69.

73
Figure 69. Specify event sequencing for business process component

Configure the Siebel adapter export for event sequencing


Follow these steps:
1. In the Siebel inbound module, select SiebelInboundInterface.
2. In the properties view, select Details -> End-point configuration.
3. Click the Connection tab.
4. Under ActivationSpec properties ensure Delivery Type is ORDERED.
5. Make sure Assured once delivery is checked.
6. In the properties view, select Details -> Performance attributes.
7. Select Async as the interaction style.
8. Set the Asynchronous reliability to assured.

An example of an event flow with event sequencing qualifiers


specified
Let’s consider these events:
1. An account is created in Siebel. The account ID is 1 and the name is Kristen.
This event is polled by the Siebel adapter and delivered to the Process Server.
2. Account 1 is updated in Siebel. The name is changed to Albert. This event is
delivered to the Process Server.
3. An account is created on Siebel. The account ID is 2 and the name is Lisa. This
event is delivered to the Process Server.
4. Account 2 is updated in Siebel. The name is changed to Alex. This event is
delivered to the Process Server.

The first event (AccountId = 1) arrives at the Siebel mediation component by invoking
the emitCreateAfterImageIOAccountInterfaceICAccount operation. No one is using the
lock with the same key and in the same group, so this event acquires the lock and
continues processing.

74
The second event (AccountId = 1) arrives at the Siebel mediation component by invoking
the emitUpdateAfterImageIOAccountInterfaceICAccount operation. This invocation is
suspended because it has the same key and belongs to the same group as event 1, and
event 1 has the lock.

The third event (AccountId = 2) arrives at the Siebel mediation component by invoking
the emitCreateAfterImageIOAccountInterfaceICAccount operation. No event with an
account ID equal to 2 that belongs to the same group is being processed, so this event
acquires the lock and continues processing.

The fourth event (AccountId = 2) arrives at the Siebel mediation component by invoking
the emitUpdateAfterImageIOAccountInterfaceICAccount operation. This invocation is
suspended because event 3 has the same key, belongs to the same group, and has the
lock.

When processing of event 1 is complete, the event sequencing runtime releases the lock
acquired by this event and grants the lock to event 2. Invocation of event 2 resumes.

When processing of event 3 is complete, the event sequencing runtime releases the lock
acquired by this event and grants the lock to event 4. Invocation of event 4 resumes.

This example shows how events with the same key that belong to the same event
sequencing group are sequenced. Other events can continue to be processed in parallel.

Test the end-to-end scenario


In this section you’ll learn how to test the data synchronization from Siebel to SAP. First
create a new account in Siebel and observe the corresponding customer created in SAP.
Then update the newly created customer and observe the corresponding customer being
updated in SAP.

Test the create account


In order for the Siebel adapter to poll events on the Siebel server, an event table and
associated scripts must be created on the Siebel server. See the WebSphere Adapter for
Siebel Business Applications product documentation for information on how to do this.
For the purposes of our test, we’ll assume that Siebel server is correctly configured so
that the Siebel adapter can poll account events from the event table on the Siebel server.

Complete the following steps to configure and deploy our three module applications to
Process Server:
1. From the server view, right-click on WebSphere Process Server v6.0.
2. Click Start to start the server.
3. After the server has been started, right-click WebSphere Process Server v6.0,
and select Run administrative console.
4. Click Log in.

75
5. Select Security -> Global security -> JAAS Configuration -> J2C
Authentication data.
6. Click New.
7. Enter Siebel_Alias as the alias. This alias must be the same alias in the “Create
Siebel inbound module” section. Authentication aliases are used by the adapters
to log on to Siebel and SAP.
8. Enter the user ID and password for your Siebel system. For our test Siebel server,
we entered SADMIN/SADMIN.
9. Click Apply and Save to save the new alias.
10. Repeat steps 6 through 9 to create an alias named SAP_Auth_Alias. This alias
must be the same alias you used in SAP outbound module.
11. Log off the administrative console.
12. In the server view, right-click WebSphere Process Server v6.0, and selectAdd
and remove projects.
13. Click Add All, then click Finish, as shown in Figure 70.

Figure 70. Deploy module applications to the server

76
Create a new Siebel Account:
1. Log on to the Siebel Sales Web client.
2. Click the Account tab.
3. Select Accounts Lists.
4. Click New to add a new Account for John Doe.
5. Click the Address icon to open the Account Address dialog.
6. Click New to add a new address as shown in Figure 71.

Figure 71. Create a new Siebel Account

7. Click Save to save the address.


8. Click OK to exit the Account Address dialog.
9. Click the IBM2 tab to view the new create event, as shown in Figure 72.

Figure 72. Create event in Siebel server

77
View the new customer in SAP
1. Log on to SAP.
2. Select Master Records -> Display as shown in Figure 73.

Figure 73. Select display customer from master record

3. Click the customer search icon as shown in Figure 74.

78
Figure 74. Search customer

4. Click the green check.


5. View the John Doe customer shown in Figure 75.

Figure 75. Display John Doe customer

Test the update account


The steps to test updating an existing account are similar to those for testing the create
account. In Siebel, instead of creating a new account, select the John Doe account just
created and change the address to 123 WebSphere Street. Save the changes, then log
on to SAP to verify that the address has been changed, as shown in Figure 76.

79
Figure 76. Updated John Doe customer

Conclusion
In this article you learned how use WebSphere Process Server, WebSphere Adapter for
SAP Software, and WebSphere Adapter for Siebel Business Applications to synchronize
customer data from Siebel to SAP. You created integration modules, interface mediation,
data maps, and configured relationships, adapters, and event sequencing. Finally, you
tested the end-to-end scenario on both Siebel and SAP.

About the author


Albert Chung is a software engineer at the IBM Research Triangle
Park Lab in Durham, North Carolina. He works on the WebSphere
Adapters team. You can reach Albert at alchung@us.ibm.com.

80

Você também pode gostar