Using WebSphere Adapters with IBM Business Process Manager to communicate with external systems

In this article, you'll learn how IBM® Business Process Manager uses WebSphere® Adapters to connect to external systems, and how data flows between external systems and the human tasks of IBM BPM. Using these capabilities, you'll see how you can integrate your BPM applications with existing systems.

Share:

Feng Li (lifengbj@cn.ibm.com), Staff Software Engineer, IBM

Feng Li photoFeng Li is a technical support engineer at the IBM China Software Development Lab. He has many years of experience providing technical support for IBM WebSphere Adapters and IBM Business Process Manager.



Jin Shang (shangjin@cn.ibm.com), Staff Software Engineer, IBM

Jin Shang photoJin Shang is a Technical Support Specialist on the WebSphere Adapters and Business Process Manager Technical Support teams at the IBM China Software Development Lab. He has 8 years of experience with the IBM WebSphere Business Process Manager suite of products.



Jia Tang (tangjia@cn.ibm.com), Staff Software Engineer, IBM

Jia Tang photoJia Tang is a technical support engineer at the IBM China Software Development Lab. She is responsible for BPM technical support, and she has many years experience on the IBM Business Process Manager suite of products.



06 March 2013

Also available in Chinese

Overview

WebSphere Adapters are used to communicate with external systems in IBM Business Process Manager (IBM BPM). This article introduces a commonly used end-to-end business scenario to demonstrate how to develop and deploy a WebSphere Apdater on IBM BPM. Using a sample business scenario, you'll see how an external record in a database comes into IBM BPM, gets processed by a human task, and finally is stored into SAP systems.

This article assumes you have a basic understanding of IBM BPM and WebSphere Adapters. You'll need the following products installed to follow the steps in the article:

  • IBM WebSphere Adapter for JDBC V7.5.0.2
  • IBM Business Process Manager V8, with IBM Integration Designer

Sample business scenario

The sample scenario imagines that a company needs to synchronize data between the HR department and a SAP system. The HR department stores all information employee information, including personal and salary information. The SAP system is used to store the bank information of the wage card. When a new employee comes on board, HR creates a new record in its DB, including name, band, salary, and the bank information of the wage card. The company requires that the personal information and salary information automatically synchronizes with the SAP system separately. Before the record comes into the SAP system, a manual approval is required and supervisors can change values as needed. Meanwhile the supervisors can create a bank record in the same Coach view and insert it into SAP system via the SAP Adapter.

A WebSphere Adapter for JDBC (JDBC Adapter) inbound process is used to poll events from the HR system. The IBM BPM Coach view provides a user interface for auditors to view and modify values. A WebSphere Adapter for SAP (SAP Adapter) BAPI outbound process is responsible for inserting bank information into the SAP system, as shown in Figure 1.

Figure 1. Sample business scenario
Sample business scenario

The following sections walk you through the steps to develop and test the scenario.


Configure the HR database

Before developing the sample business scenario, you need to create and trigger the following tables in the HR database. We used Oracle® Database 9i in this scenario.

Listing 1. Scripts to create the Oracle database
/*Scripts for creating the tables in Oracle database*/

CREATE TABLE Employee
(
      empl_id             int not null Constraint pk_emplid PRIMARY KEY,
      empl_fname          varchar(50) not null,
      empl_lname          varchar(50) not null,
      empl_age            varchar(10) null,
      empl_band           varchar(10) not null,
      empl_salary         varchar(30) not null,
      empl_bankid         varchar(10) not null,
      empl_bankname       varchar(50) null,
      empl_bankcoun       varchar(50) null,
      empl_bankcity       varchar(50) null,
      empl_bankstreet    varchar(255) null
);

CREATE TABLE wbia_jdbc_eventstore
(
	event_id		NUMBER(20)	PRIMARY KEY,
	xid			VARCHAR2(200),
	object_key		VARCHAR2(80)	NOT NULL,
	object_name		VARCHAR2(40)	NOT NULL,
	object_function	VARCHAR2(40)	NOT NULL,
	event_priority	         NUMBER(5)	NOT NULL,
	event_time		DATE	DEFAULT SYSDATE NOT NULL,			
	event_status		NUMBER(5)	NOT NULL,
	connector_ID             VARCHAR2(40),
	event_comment	         VARCHAR2(100)
);

/*Scripts for creating the trigger for Employee table*/

CREATE SEQUENCE event_sequence start with 1;

CREATE OR REPLACE TRIGGER event_create
AFTER INSERT ON Employee
FOR EACH ROW
BEGIN
INSERT INTO
wbia_jdbc_eventstore (event_id, object_key, object_name, object_function, event_priority, 
    event_status,connector_ID)
VALUES(event_sequence.nextval, :NEW.empl_id, 'JcajdbcEmployeeBG', 'Create', 1, 0,
    'CreateEmployee');
END;

Connect to the SAP system using the SAP Adapter

In this example, we use the BAPI call BAPI_BANK_CREATE to create bank information in SAP. SAP Adapter Outbound sends a request to the SAP server. The SAP Adapter BAPI import component is invoked by IBM BPM and uses RFC to connect to the SAP system to insert records. To make the SAP Adapter Outbound module reusable by other applications, we'll package it into a toolkit. To configure the SAP Adapter for outbound processing and package it in a toolkit, complete the following steps:

  1. Open IBM Integration Designer and connect to Process Center by clicking Getting Started with IBM Process Center, as shown in Figure 2, select Toolkits.
    Figure 2. Getting Started with IBM Process Center
    Getting Started with IBM Process Center
  2. Click Create new toolkit on the right, name the toolkit SAPAdapter_BankCreateTK, and open the new toolkit in the workspace.
  3. Select File => New => External Service.
  4. Select SAP under Available types and click Next.
  5. Select IBM WebSphere Adapter for SAP Software with transaction support(IBM:7.5.0.2_IF01) and click Next.
  6. Import CWYAP_SAPAdapter_Tx and click Next.
  7. Find and select the three JCO files and click Next.
  8. Select Outbound and click Next.
  9. Specify the appropriate properties for your environment and select BAPI for SAP interface name, then click Next.
  10. Locate the BAPI BAPI_BANK_CREATE and add it to Selected object, then click Next.
  11. Click Next again.
  12. Check Using security properties from the managed connection factory under Deployment Properties, and click Next.
  13. Select the SAPAdapter_BankCreateTK_Implementation module and click Finish. You should see an adapter import component generated in the assembly diagram, as shown in Figure 3.
    Figure 3. New import component in assembly diagram
    New import component in assembly diagram
  14. Right-click the Adapter project CWYAP_SAPAdapter_Tx, select Associate with Process Center, then complete the wizard using the default options.
  15. Drag the business object and interface from SAPAdapter_BankCreateTK_Implementation to SAPAdapter_BankCreateTK_Library, as shown in Figure 4.
    Figure 4. Move the business object and interface
    Move the business object and interface
  16. Add an export component in the assembly diagram called CreateBank.
  17. Add an interface called SAPOutboundInterface to the CreateBank export component.
  18. Right-click CreateBank and select Generate Binding => SCA binding.
  19. Wire the two components in the assembly diagram and save the changes.
  20. Right-click SAPAdapter_BankCreateTK and slect Refresh and Publish to save the changes to Process Center.
  21. Open the toolkit in the Process Center perspective and click Create New Snapshot on the in right, as shown in Figure 5.
    Figure 5. Create a new snapshot
    Create a new snapsho
  22. Specify SAPAdapter_BankCreateTK_V1 as the name of the new snapshot.

You have now configured the SAP Adapter for outbound processing and created a SAP Adapter outbound toolkit.


Create a new process and bind the Advanced Integration Service

The process we create will be used to receive messages from the HR system via JDBC Adapter outbound processing, will provide a Coach view so that supervisors can review, and will then deliver the message to SAP via the SAP Adapter. To create this process, complete the following steps:

  1. Open Process Designer and create a new process application named JDBC2SAP.
  2. Open the new application in Process Designer.
  3. Create a new business object (BO) by clicking Business Object under Data on left and name it BankBO.
  4. Add the following parameters to this BO, as shown in Figure 6:
    • empl_bankid (String)
    • empl_bankname (String)
    • empl_bankcoun (String)
    • empl_bankcity (String)
    • empl_bankstreet (String)
    Figure 6. Add parameters
    Add parameters
  5. Create a new AIS by selecyting Implementation => Advanced Integration Service and name it SAPAIS.
  6. Add an input variable under the parameters of the AIS and name it BankBOAIS, then set the Parameter Type to the BankBO you defined above.
  7. Create a new process by selecting Processes => Business Process Definition and name it MyProcess.
  8. Add an input variable to the process named myBandBO and set the Variable Type to BankBO.
  9. Add a human task to the process and name it Supervisor Review.
  10. Right-click the new human task, select Activity Wizard and then complete the wizard using the default options.
  11. Double-click the Supervisor Review human task to open the Coach.
  12. Select the Coaches tab, then click New in the bottom right to create a new Coach view, as shown in Figure 7. Name the view BandBOCV.
    Figure 7. Create a new Coach view
    Create a new Coach view
  13. In the Coach view, drag the BankBO variable on the right into the Layout panel. Your Coach view should now look like Figure 8.
    Figure 8. Coach view layout
    Coach view layout
  14. Save and close the Coach view and the Coach.
  15. Add a system task to the process and name it SAP Adapter Outbound, and bind it to the SAPAIS AIS you created earlier, as shown in Figure 9.
    Figure 9. Bind the system task to AIS
    Bind system task to AIS
  16. Under Data Mapping of the Property of SAP Adapter Outbound, select tw.local.myBankBO for Input Mapping.
  17. Wire all components in the following sequence: Start +> Supervisor Review => SAP Adapter =>End, as shown in Figure 10.
    Figure 10. Wire the components
    Wire the components

Next we'll implement the AIS component in Integration Designer.


Implement the AIS

In this section, we'll implement the AIS with the SAP Adapter. ??? users are able to input value in coach and deliver to SAP then.

  1. Open IBM Integration Designer and connect to Process Center.
  2. Open the JDBC2SAP project in the workspace.
  3. Right-click Dependent Toolkits and select Change Toolkit Dependencies.
  4. In the pop-up window, select the SAPAdapter_BankCreateTK_V1 snapshot that you created earlier.
  5. Open the dependency JDBC2SAP_Implementation and add SAPAdapter_BankCreateTK_Library to Libraries, then click Save.
  6. Right-click the AIS component SAPAIS and click Implement, as shown in Figure 11.
    Figure 11. Implement the AIS
    Implement the AIS
  7. Select Microflow and complete the wizard using the default options.
  8. Open the assembly diagram for JDBC2SAP_Implementation.
  9. Add an import component in the assembly diagram and name it CreateBankInfo, then add an interface named SAPOutboundInterface.
  10. Right-click CreateBankInfo and select Generate Binding =>SCA Binding.
  11. On the Properties tab of CreateBankInfo, under Binding specify a new module with the name SAPAdapter_BankCreateTK_Implementation and an export name of CreateBank.
  12. Wire SAPAIS_Process to CreateBankInfo.
  13. Right-click SAPAIS_Process, then select Regenerate Implementation, and then Save.
  14. In the regenerated microflow SAPAIS_Process, add a variable SAPBapiBankCreateBO with a type of SAePBapiBankCreate.
  15. Put a Data Map between Receive and Reply. A Map wizard displays to help you initialize the mapping, and specify configuration such as the type of map, and the input variable and output variable.
  16. Select XML Map and name it BankBO2SAPBO, then add BankBOAIS as an input variable and add SAPBapiBankCreateBO as an output variable.
  17. Map attributes from BandBOAIS to SAPBapiBankCreateBO, as shown in Figure 12.
    Figure 12. Map attributes
    Map attributes
  18. Add an invoke component between the DataMap and the Reply and bind it to SAPOutboundInterfacePartner, as shown in Figure 13.
    Figure 13. Add an Invoke component
    Add an Invoke component
  19. Right-click JDBC2SAP and select Refresh and Publish to save changes in Process Center.

Users can now input values in the Coach and update the SAP system. We'll test this is Test the scenario.


Connect to HR database with JDBC Adapter inbound processing

JDBC Adapter inbound processing enables an application to receive notification when objects in the database are changed. In this scenario, the HR system inserts a record into the employee table in the database. The change triggers an update to the event store with information about the change. Periodically, JDBC adapter polls the event store, retrieves and processes events, and then delivers them to the export of a module that is part of an application that runs in BPM.

Complete the following steps to configure the adapter for inbound processing:

  1. Start the external service wizard by selecting File => New => External Service.
  2. Under Available Types, select Adapters => JDBC and click Next.
  3. Select IBM WebSphere Adapter for JDBC (IBM: 7.5.0.2) and click Next.
  4. In the Connector project field, enter CWYBC_JDBC, and choose IBM Process Server v8.0 as the runtime environment. Click Next.
  5. In the JDBC driver JAR files field, click Add to add the JDBC driver file to establish the connection with Oracle Database. Browse to select the driver JAR file and click Next.
  6. We need to detect new record in Oracle Database in this scenario, so choose Inbound in the Select Processing Direction window, and click Next.
  7. Specify connection properties for the external service wizard in the Specify the Discovery Properties window. Expand the Oracle node in the database system connection information area and then select the correct version. Specify appropriate values in the System ID, Host name, Port number, User name and Password fields, and click Next.
  8. Select the business objects and services to be used with JDBC adapter under Find Objects in the Enterprise System window.
  9. In the Find Objects in Enterprise System window, click Run Query. Expand the schema in which the prerequisite Oracle tables are created. Select and expand Tables, then select the Employee table and click the > button to add it to Selected objects area. Click Next.
  10. The Specify Composite Properties window enables you to choose operations for selected business objects. For our example, keep Create and remove the others, then click Next.
  11. In the Specify the Service Generation and Deployment Properties window, select the security credential Using security properties from the activation specification. The user and password information are displayed in the window, as shown in Figure 14. You don't need to change any other configuration in this window. Click Next.
    Figure 14. Specify deployment properties
    Specify deployment properties
  12. In the Select a Business Integration Project Type window, browse to and select the JDBC2SAP_Implementation module and click Finish.
  13. After generating the artifacts of the JDBC adapter inbound process, you need to associate the connector project CWYDB_JDBC with the process application JDBC2SAP. Otherwise, you'll get runtime errors. Right-click on CWYDB_JDBC and select Associate with Process Center, as shown in Figure 15.
    Figure 15. Associate with Process Center
    Associate with Process Center
  14. In the Associate with a Process Application or Toolkit window, select the process application JDBC2SAP that will contain the project, as shown in Figure 16, and click Finish.
    Figure 16. Associate with process application
    Associate with process application

Assemble JDBC Adapter Inbound in the process

In this section, we'll make the JDBC Adapter Inbound able to deliver a message to the process. To do this, please complete the following steps:

  1. Drag MyProcess from the left into the assembly diagram, select Use a one-way invocation style, and click OK, as shown in Figure 17.
    Figure 17. Add MyProcess to assembly diagram
    Add MyProcess to assembly diagram
  2. Add a BPEL process component into the assembly diagram and change its name to JDBCAdapter2Process, then add JDBCInboundInterface to it.
  3. Wire JDBC Adapter Inbound => Component1 => MyProcess. Your assembly diagram should look like Figure 18.
    Figure 18. Assembly diagram
    Assembly diagram
  4. Double-click JDBCAdapter2Process and click Yes in pop-up diagram to implement the BPEL process.
  5. Add a variable named myBankBO with a type of BankBO.
  6. Put a Data Map between Receive and End. A a wizard will display to help you initialize the mapping and specify information such as the type of map, and the input variable and output variable.
  7. Select XML Map and specify JDBCBO2BankBO as the name, then add createJcajdbcEmployeeBGFInput as input variable and add myBankBO as output variable.
  8. Map attributes from JcajdbcEmployeeBG to BankBO, s shown in Figure 19.
    Figure 19. Map attributes
    Map attributes
  9. Add an invoke component between the DataMap and the End and bind it to MyProcessOneWayPartner, then bind the input variable to myBankBO.
  10. Right-click JDBC2SAP and select Refresh and Publish to save changes to Process Center.

Test the scenario

Now that the scenario implementation is complete, you can test it using the test cases in this section.

Test 1: Crreate bank information using the Coach

  1. Open Process Designer.
  2. Start MyProcess.
  3. Specify the values 123, ICBC, CN, Beijing, Dong Bei Wang west street) in the Coach and submit.

    The information is submitted to SAP via the SAP Adapter. You should be able to see that the bank information has been created in the SAP system.

Test 2: Synchronize bank information into SAP when new employee information is created in the HR database

  1. Use the SQL script below to insert a record into the HR Oracle Database.
    Listing 2. Insert employee record
    /*Scripts to insert a new record in Oracle database*/
    Insert into Employee values ( '111', 'san', 'zhang', '31', '7', '11000', '123', 
    'ICBC', 'CN', 'Beijing', 'Dong Bei Wang west street');
    commit;

    The predefined trigger in Oracle will automatically add one event record in the JDBC Adapter event table. The event is picked up by the JDBC Adapter export component. The event is delivered to process and waits for supervisors to review.

  2. Using tw_admin, log on to Process Portal and view the message.
  3. Change nothing and click the button to approve.
  4. Check SAP and you should see that the bank information is already created.

Conclusion

This article introduced how to use the JDBC Adapter and SAP Adapter in IBM Business Process Manager to synchronize Oracle Database with a SAP system. We created a human task that enabled supervisors to modify the information between the JDBC Adapter and SAP Adapter. Following the steps in this article, you've seen how to use WebSphere Adapters to integrate BPM and external systems. Your BPM applications can leverage existing systems and quickly deliver business data wherever its needed.


Download

DescriptionNameSize
Process applicationJDBC2SAP.twx8KB

Resources

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

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

 


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

All information submitted is secure.

Choose your display name



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

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

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

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

 


All information submitted is secure.

Dig deeper into Business process management on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Business process management, WebSphere
ArticleID=860497
ArticleTitle=Using WebSphere Adapters with IBM Business Process Manager to communicate with external systems
publish-date=03062013