5.4.1 Creating business processes

For a business process, define how the request received from the service requester will be processed. The Hello business process of the HelloBusinessProcess sample program executes processing as follows:

  1. The Hello business process receives the character string entered from the service requester.
  2. The Hello service is called via the Hello service adapter.
  3. When the Hello service is called, the following character string is concatenated to the received one: [Figure]and[Figure]Business[Figure]Process ([Figure]: single-byte space)

    Generated string: string-output-by-Hello-service[Figure]and[Figure]Business[Figure]Process

  4. The concatenation result is returned to the service requester, and is displayed in the output window.

 

Define a business process of the HelloBusinessProcess sample program as follows:

  1. Add a new business process.
  2. Set variables.
  3. Deploy activities#.
  4. Define activities#.
  5. Finish defining the business process.
    #
    An activity is a component that defines an overview of the processing of a business process.
Organization of this subsection
(1) Adding a business process
(2) Setting variables
(3) Deploying activities
(4) Defining activities

(1) Adding a business process

The following table shows the values that you need to set when adding a business process.

Table 5-2 Values that need to be set when adding a business process

ItemValue to be setDescription
Business process nameHelloBusinessProcessSpecify the name of the business process.
Status persistenceyesSpecify whether to leave records in the database.
Records left in the database can be used to check the progress of a process. For this sample program, you leave records in the database. Therefore, select yes.
Import check box in the BPEL file areaClear the check box.Specify whether to import the BPEL file that was created by using a tool in the upper process.
If you import the BPEL file, the activities necessary for the business process are automatically displayed. For this sample program, you do not import the file. Therefore, clear the check box.
Service IDHelBPSpecify the ID of the business process.

The following is the procedure for adding the Hello business process.

  1. In the tree view, select and right-click Service Definition List, and then select Add Business Process.

    [Figure]

    The dialog box for adding a business process definition appears.
  2. Enter HelloBusinessProcess in Business Process Name, and then select yes for Status Persistence. Clear the Import check box in the BPEL file area.

    [Figure]

  3. Click the Finish button.
    A business process named HelloBusinessProcess is created, and then the Define Business Process window appears.
  4. In the tree view, select HelloBusinessProcess.
    A list of properties for the Hello business process is displayed in the properties view.
  5. In the properties view, click the cell for the value of the service ID.
    A value can be entered in the cell.
  6. Change the value to HelBP, and then press the Enter key.

    [Figure]

  7. When a message asking you whether you really want to change the value appears, click the OK button.

(2) Setting variables

For a business process, variables are used to define activities. Therefore, the variables to be used must be set before activities are defined. The following table shows the variables to be used for the Hello business process.

Table 5-3 Variables to be used for the Hello business process

Variable nameTypeXSD file
InputDataXMLInputData.xsd
OutputDataXMLOutputData.xsd

The following is the procedure for setting the variables to be used for the Hello business process.

  1. On the canvas of the Define Business Process window, double-click the Variable-Correlation icon.

    [Figure]

    The List Of Variables And Correlation Sets dialog box appears.
  2. In the tree view, select Variable List.
  3. Enter InputData in Variable name, and then select XML from the Type drop-down list.

    [Figure]

  4. Click the Take In button.
    The Take In Message Format dialog box appears.
  5. Select Service name, and then, from the drop-down list, select Hello service adapter.
  6. Select getHelloString from the Operation name drop-down list, and Request message (Body) from the Message type drop-down list. For Message format, enter InputData.

    [Figure]

  7. Click the OK button.
    The Take In Message Format dialog box closes.
  8. In the List Of Variables And Correlation Sets dialog box, click the Add button.
    InputData is added to the Variable List node in the tree view.
  9. In the List Of Variables And Correlation Sets dialog box, select Variable List. Enter OutputData in Variable name, and then select XML from the Type drop-down list.
  10. Click the Take In button.
    The Take In Message Format dialog box appears.
  11. Select Service name, and then, from the drop-down list, select Hello service adapter.
  12. Select getHelloString from the Operation name drop-down list, and Response message (Body) from the Message type drop-down list. For Message format, enter OutputData.

    [Figure]

  13. Click the OK button to close the Take In Message Format dialog box.
  14. In the List Of Variables And Correlation Sets dialog box, click the Add button.
    OutputData is added to the Variable List node in the tree view.
  15. In the List Of Variables And Correlation Sets dialog box, click the OK button.
    The variables are now set.

    [Figure]

(3) Deploying activities

The following table shows the activities that are necessary for the business process of the HelloBusinessProcess sample program.

Table 5-4 Activities necessary for the business process of the HelloBusinessProcess sample program

Value to be setDescription
Receive activityReceives a response from the service requester
Invoke service activityCalls the Hello service
Data transformation activityEdits a string
Reply activityReturns the processing result to the service requester

The following shows the activity deployment procedure.

  1. On the palette, click the following activities, and then place them at appropriate positions by clicking them on the canvas.
    • Receive
    • Invoke service
    • Data transformation
    • Reply
  2. To connect activities, on the palette, click [Figure]Connection.
  3. Click the start activity to start the connection.
  4. Click the receive activity as the connection destination.
    The start activity is now connected to the receive activity.
  5. Chain the activities by connecting adjacent ones (as in steps 2 to 4) from the receive activity to the reply activity.
    Make sure that the activities are chained as follows.

    [Figure]

(4) Defining activities

Define each of the activities that were placed on the canvas.

(a) Receive activity
  1. Double-click the receive activity on the canvas.
    The Receive Activity dialog box appears.
  2. Enter information as shown in the following figure.

    [Figure]

    ItemValue to be setDescription
    Activity nameReceiveSpecify the name of the activity.
    Operation namegetHelloStringSpecify the name of the operation that is used to call a service component from the service requester.
    Body allocated variableInputDataFrom the drop-down list, select the variable to be allocated to the body of the request message for the business process.
    Header allocated variableNoneSet this item when you allocate a variable to the header of the request message for the business process. This item is not used for this sample program. Therefore, do not set this item.
    Correlation set groupNoneSet this item when you allocate a correlation set group to an activity. This item is not used for this sample program. Therefore, do not set this item.
    Communication modelSyncSpecify the communication model of the operation. The Hello service used for this sample program is a Web Service. Therefore, set Sync.
    Instance generationyesSelect whether to initialize the process when a request message is received. For this sample program, set yes.
  3. Click the OK button.
(b) Invoke service activity
  1. Double-click the invoke service activity on the canvas.
    The Invoke Service Activity dialog box appears.
  2. Enter information as shown in the following figure.

    [Figure]

    ItemValue to be setDescription
    Activity nameHelloServiceEnter the name of the activity.
    Service nameHelloServiceAdapterFrom the drop-down list, select the name of the service component to be called by sending a request message.
    Operation namegetHelloStringAmong the operations for the service component (Hello service adapter) specified in Service name, select the name of the operation that is to be called from the drop-down list.
    Communication modelSyncThe communication model set for the operation specified in Operation name is displayed.
    Body allocated variable (in the Request message area)InputDataFrom the drop-down list, select the variable to be allocated to the body of the request message that calls the stock management service.
    Header allocated variable (in the Request message area)NoneSet this item when you allocate a variable to the header of the request message that calls the stock management service. This item is not used for this sample program. Therefore, do not set this item.
    Body allocated variable (in the Response message area)OutputDataFrom the drop-down list, select the variable to be allocated to the body of the response message to be received from the synchronization operation.
    Header allocated variable (in the Response message area)NoneSet this item when you allocate a variable to the header of the response message to be received from the synchronization operation. This item is not used for this sample program. Therefore, do not set this item.
    Correlation set groupNoneSet this item when you allocate a correlation set group to an activity. This item is not used for this sample program. Therefore, do not set this item.
  3. Click the OK button.
(c) Data transformation activity
  1. Double-click the data transformation activity on the canvas.
    The Data Transformation Activity dialog box appears.
  2. Enter information as shown in the following figure.

    [Figure]

    ItemValue to be setDescription
    Activity nameEditOutputStringSpecify the name of the activity.
    Variable (in the Source Variables area)OutputDataSelect the transformation-source variable from the drop-down list, and then click the Add button.
    Variable (in the Destination Variable area)OutputDataSelect the transformation-destination variable from the drop-down list.
    DataTransDefnFileEditOutputStringSpecify a name for the data transformation definition file.
  3. Click the OK button.
  4. Right-click the data transformation activity on the canvas, and then select Launch mapping definition.
    The Select Root Element dialog box appears.
  5. As the root element of OutputData (schema logical name) for Source, select hls:getHelloStringResponse from the drop-down list. As the root element of OutputData (schema logical name) for Target, select hls:getHelloStringResponse.

    [Figure]

  6. Click the OK button.
    The data transformation definition window appears.

    [Figure]

  7. On the palette of the data transformation definition window, click concat. Then, on the canvas, click between the transformation source and destination to place the concat there.
  8. On the palette of the data transformation definition window, click const. Then, on the canvas, click between the transformation source and destination to place the const there.
  9. On the palette of the data transformation definition window, select Mapping.
  10. Click the node adapter of the transformation-source node as the mapping source.
  11. Click concat as the mapping destination.
    A mapping line is set.
  12. In the same way as steps 9 to 11, set a mapping line from concat to the node adapter of the transformation-destination node.
    Do not set a mapping line from const to concat first. Doing so will change the order of output strings.
  13. In the same way as steps 9 to 11, set a mapping line from const to concat.

    [Figure]

  14. On the palette of the data transformation definition window, click Select.
  15. Double-click const.
    The Set Constant dialog box appears.
  16. Select String, and then enter the following character string: [Figure]and[Figure]Business[Figure]Process ([Figure]: single-byte space)

    [Figure]

  17. Click the OK button.
(d) Reply activity
  1. Double-click the reply activity on the canvas.
    The Reply Activity dialog box appears.
  2. Enter information as shown in the following figure.

    [Figure]

    ItemValue to be setDescription
    Activity nameReplySpecify the name of the activity.
    Operation namegetHelloStringSpecify the name of the operation specified for the corresponding receive activity.
    Body allocated variableOutputDataFrom the drop-down list, select the variable to be allocated to the body of the response message.
    Header allocated variableNoneSet this item when you allocate a variable to the header of the response message. This item is not used for this sample program. Therefore, do not set this item.
    Correlation set groupNoneSet this item when you allocate a correlation set group to an activity. This item is not used for this sample program. Therefore, do not set this item.
    Fault nameNoneDefine the reply activity as fault processing, and then specify the fault name to be used when a response message that indicates that a fault occurred in the service requester is received. No fault processing is used for this sample program. Therefore, do not set this item.
  3. Click the OK button.
  4. When you have defined all activities, from the menu, select File and then Save. The business process is now defined.