Skip to main content

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

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

All information submitted is secure.

  • Close [x]

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.

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

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

Build and deploy a business process model using WebSphere Business Process Modeler Advanced and Lotus Forms, Part 2: Implement and test the BPEL process using WebSphere Integration Developer

Attila Kiss (attila_kiss_bme@yahoo.com), Student, Budapest University of Technology and Economics
Attila Kiss
Attila Kiss attends Budapest University of Technology and Economics and will graduate as a Computer Science Engineer in 2008. He specializes in IT infrastructure management. He has been working with WebSphere products with special focus on business modeling.
Viktor Muller (viktormuller@gmail.com), Student, Budapest University of Technology and Economics
Viktor Muller Photo
Viktor Müller attends Budapest University of Technology and Economics and graduates as a Computer Science Engineer in 2009. He specializes in information system development. He has worked with WebSphere products with a special focus on BPEL development.

Summary:  Learn how to use IBM® WebSphere® Integration Developer to implement and customize a Business Process Execution Language (BPEL) process and then test it in WebSphere Process Server. Part 2 of this tutorial series shows you the steps for generating the Web interface, assembling the components, and testing the solution.

View more content in this series

Date:  15 Apr 2009
Level:  Intermediate PDF:  A4 and Letter (3098 KB | 55 pages)Get Adobe® Reader®

Activity:  13364 views
Comments:  

Implementing the information service activities

This section shows you hot to create and implement information service activities.

Creating information service activities

An information service allows you to perform database operations. Some information is needed (from the banned list, described later) to make the decision in the PreCheck activity. Therefore, you need two information services before PreCheck.

Before you can add the information service activities you must have the Information Server plug-in installed into Integration Developer. See for details about how to download and install the plug-in.

To add extra activities to your BPEL process:

  1. Right-click PreCheck.
  2. Select Insert before on context menu.

    Figure 12. Creating information service activities
    Creating information service activities

  3. Select Information service.

    Another way to add a new activity is drag-and-dropping it from the Palette.

  4. Select Basic Actions > Information Service.
  5. Drop it to the canvas.
  6. Link the two new activities between LoadApplicationToRepository and PreCheck.You do not need to link RecordingApplicantData to ReadBannedList because you will implement that activity later.

    Rename the activities.

  7. Select Rename from the context menu of the first information service activity.
  8. Type ReadBannedList.
  9. Rename the second activity to RetrieveBannedListResult.

    Figure 13. The renamed activities
    The                                 renamed activities

The contents of the diagram can be auto-arranged any time by selecting Align Parallel Activities Contents Automatically from the context menu of the canvas.


Creating the necessary data types and variables

In this step you prepare the process to use information service tasks. Information service tasks allow accessing a relational database directly from the process without Java coding. First you need to define and set up three technical variables in the process. You will initialize the database and configure WebSphere Process Server (hereafter referred to as Process Server) later.

  1. Right-click on HRProcess in the Business Integration view.
  2. Choose Create Information Service Support Types. After this you should see several new data types starting with “t”.

    Figure 14. Creating information service support types
    Creating information service support types



    Figure 15. Viewing data types
    Viewing                                 data types

  3. Add a new variable HRDataSourceVariable of type tDataSource to the process by clicking the + sign by the Variables on the right-hand tab.
  4. Add BannedListSetVariable and BannedListSetReferenceVariable of type tSet and tSetReference.

    Figure 16. Adding new variables
    Adding                                 new variables

You will use these variables in the information service task. But you need to configure their initial value first.

  1. Select the BannedListSetReferenceVariable from the Variables.
  2. Click Properties => Initial Value.
  3. Select Generate name for both Schema and Table.
  4. Enter the JNDI name: jdbc/HRDataSource.

    Figure 17. Setting initial values
    Setting                                 initial values

  5. Select HRDataSourceVariable.
  6. Set the Properties => Initial Value => Data source JNDI name to jdbc/HRDataSource.

HRDataSourceVariable holds a reference (JNDI name) to a database connection pool configured on the server. BannedListSetReferenceVariable points to a temporary table in the database defined by HRDataSourceVariable . This table holds the results of the query. BannedListSetVariable is the in-memory representation of the data pointed to by BannedListSetReferenceVariable on the Process Server.


Creating an SQL Snippet

For now you prepared everything to use information service tasks in the process. In this step you create an SQL Snippet. The snippet executes a simple query using HRDataSourceVariable and stores the results in a temporary table that can be accessed by the BannedListSetReferenceVariable.

  1. Select ReadBannedList on the process canvas.
  2. Click Details.
  3. Select SQL Snippet as the kind of the information service.
  4. Click Yes to the warning.
  5. Click Edit by Data source.
  6. Select HRDataSourceVariable as the data source.

    Figure 18. Selecting a data source variable
    Selecting a data source variable

  7. Click Edit by the Result set reference.
  8. Click New.
  9. Select Always create a new table for the Preparation field.
  10. Select Drop the table at the end of the process instance for the Cleanup field.

    Figure 19. Editing result set references
    Editing                                 result set references

    These settings can cause high performance overhead.

  11. Select BannedListSetReference for the variable.
  12. Click OK.
  13. Enter SELECT EMAIL FROM DEMO.BANNEDLIST WHERE EMAIL = in the SQL Statement text field.
  14. Click Parameter.
  15. Enter ApplicantsEmail as Display name.
  16. Select in for Kind.
  17. Select ApplicationVariable_2/ApplicantBase/Emailaddress for the Variable.

    Figure 20. Setting parameters
    Setting                                 parameters

    Note: In an SQL Snippet you cannot use aggregating functions.



    Figure 21. The SQL snippet
    The SQL                                 snippet

With these steps you created an SQL Query that selects all the rows from the BANNEDLIST table where the EMAIL column equals to the e-mail address of the applicant being processed. The result is stored in a temporary table referenced by BannedListSetReferenceVariable. The table will be created on each invocation of this task and dropped at end of the process instance. Each process instance will have a separate table.


Creating a Retrieve Set

In the previous step you selected all the entries from BANNEDLIST that have the same e-mail as the applicant into a temporary table. In this part you count the entries in the temporary table and store that information in BannedListSetVariable.

  1. Select RetrieveBannedListResult on the process canvas.
  2. Click Details.
  3. Select Retrieve Set as the kind of the information service.
  4. Click Yes to the warning.
  5. Select BannedListSetReferenceVariable as the Source.
  6. Select BannedListSetVariable as the Target.
  7. Change the SQL statement to SELECT COUNT(*) FROM #SetReference#

    Figure 22. Creating a retrieve set
    Creating a retrieve set


Creating the Java Snippet PreCheck

In this step you access the data stored in BannedListSetVariable from a Java snippet and use it to assign a value to booleanVariable. booleanVariable is used in the transition expression of the links outgoing PreCheck to determine whether the applicant passed this phase. You will also output some logging information to the console.

  1. Right-click PreCheck on the process canvas.
  2. Select Change Type > Snippet.
  3. Click Details.
  4. Select Java and click Yes to the question.
  5. Enter the following snippet into the text editor.
    BusinessObjectSimpleAnyType result = (BusinessObjectSimpleAnyType) 
                     BannedListSetVariable.get(„data/row[1]/column[1]/value”);
    Integer quantity =  new Integer(((Number)result.getValue()).intValue());
    this.booleanVariable = new Boolean(quantity.intValue() == 0);
    System.out.println(„Email matches: ” + quantity);
    

  6. Click on the canvas.
  7. Navigate to Properties > Java Imports.
  8. Enter the following line to import the necessary Java artifact.
    import com.ibm.ws.bo.bomodel.BusinessObjectSimpleAnyType;
    



    Figure 23. Importing a Java artifact
    Importing a Java artifact

4 of 14 | Previous | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Business process management, WebSphere
ArticleID=432422
TutorialTitle=Build and deploy a business process model using WebSphere Business Process Modeler Advanced and Lotus Forms, Part 2: Implement and test the BPEL process using WebSphere Integration Developer
publish-date=04152009
author1-email=attila_kiss_bme@yahoo.com
author1-email-cc=crothemi@us.ibm.com
author2-email=viktormuller@gmail.com
author2-email-cc=crothemi@us.ibm.com