5.5.3 Defining the product arrangement business process

The product arrangement business process of the HelloProductArrangement sample program executes processing as follows:

  1. The product arrangement business process receives the product name and quantity entered from the service requester.
  2. The stock management service is called via the stock management service adapter.
  3. When the stock management service is called, if the product is out of stock, an asterisk (*), which means out of stock, is returned to the service requester.
  4. If the product is in stock, the delivery number is obtained by calling the delivery reception service via the delivery reception service adapter.
  5. The obtained delivery number is returned to the service requester.

Note that because the product arrangement business process is called by using a user-defined reception, you need to create a user-defined reception by using WSDL (ArrangementService.wsdl).

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

  1. Add a new business process.
  2. Add a user-defined reception.
  3. Set variables.
  4. Deploy activities.
  5. Define activities.
  6. Finish defining the business process.
Organization of this subsection
(1) Adding a business process
(2) Adding a user-defined reception
(3) Setting variables
(4) Deploying activities
(5) Defining activities

(1) Adding a business process

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

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

ItemValue to be setDescription
Business process nameProductArrangementSpecify the name of the business process.
Status persistenceyesSpecify whether to leave records in the database. The 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.To import the BPEL file that was created by using a tool in the upper process, select the check box. If you import the 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 IDArrBPSpecify the ID of the business process.

The following is the procedure for adding the product arrangement business process.

  1. In the tree view, select and right-click Service Definition List, and then select Add Business Process.
    The dialog box for adding a business process definition appears.
  2. Enter ProductArrangement 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 ProductArrangement is created, and then the Define Business Process window appears.
  4. In the tree view, select Product Arrangement.
    A list of properties for the ProductArrangement 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 ArrBP, 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) Adding a user-defined reception

The HelloProductArrangement sample program receives a request from the service requester by using a reception that has been defined by the user according to the interface of the business process. The interface of the business process includes the operation name and message format to be set for the receive activity and reply activity. The following table shows the values that you need to set when adding a user-defined reception.

Table 5-8 Values that need to be set when adding a user-defined reception

ItemValue to be setDescription
Reception typeSOAP ReceptionSelect the reception type.
Reception nameServiceReceptionSpecify the name of the user-defined reception.
WSDL fileArrangementService.wsdlSpecify the name of the WSDL file to be used.
Port nameArrangementSpecify the port name.
Note:
For details about the location of the file, see A.3 Configuration of the HelloProductArrangement sample program.

 

The following is the procedure for adding a user-defined reception for product arrangement.

  1. In the tree view, select and right-click the Product Arrangement business process, and then select Add User Defined Reception.

    [Figure]

    The dialog box for selecting the reception type appears.
  2. From the Reception type drop-down list, select SOAP Reception.

    [Figure]

  3. Click the Next button.
    The dialog box for adding the SOAP reception appears.
  4. Enter ServiceReception as the reception name, and then specify ArrangementService.wsdl as the WSDL file.

    [Figure]

  5. Click the Next button.
  6. From the drop-down list, select Arrangement, and then click the Finish button.

    [Figure]

    The SOAP reception is added to the business process, and then the window for defining a user-defined reception appears.

    [Figure]

(3) 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 product arrangement business process.

Table 5-9 Variables to be used for the product arrangement business process

Variable nameTypeXSD file
InputDataXMLInputData.xsd
OutputDataXMLOutputData.xsd
StockAllocationInputDataXMLStockAllocationInputData.xsd
StockAllocationOutputDataXMLStockAllocationOutputData.xsd
DeliveryArrangementInputDataXMLDeliveryArrangementInputData.xsd
DeliveryArrangementOutputDataXMLDeliveryArrangementOutputData.xsd

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

  1. On the canvas of the Define Business Process window, double-click the Variable-Correlation icon.
    The List Of Variables And Correlation Sets dialog box appears.
  2. Select Variable List. Enter InputData in Variable name, and then select XML from the Type drop-down list.
  3. Click the Take In button.
    The Take In Message Format dialog box appears.
  4. Select Reception name, and then, from the drop-down list, select Service Reception.
  5. Select arrangeItem from the Operation name drop-down list, and Request message (Body) from the Message type drop-down list. For Message format, enter InputData.

    [Figure]

  6. Click the OK button.
    The Take In Message Format dialog box closes.
  7. In the List Of Variables And Correlation Sets dialog box, click the Add button.
    The InputData variable is added to the Variable List node.
  8. In the same way as steps 2 to 7, set the variables OutputData, StockAllocationInputData, StockAllocationOutputData, DeliveryArrangementInputData, and DeliveryArrangementOutputData.
    The values to be set are as follows.
    All of the types set in the List Of Variables And Correlation Sets dialog box are XML. The values to be set in the Take In Message Format dialog box are as follows.
    ItemVariable name
    OutputDataStockAllocationInputDataStockAllocationOutputDataDeliveryArrangementInputDataDeliveryArrangementOutputData
    Service/ReceptionReception nameService nameService nameService nameService name
    Name of Service/ReceptionServiceReceptionStockManagementStockManagementDeliveryReceptionDeliveryReception
    Operation namearrangeItemreserveItemreserveItemdeliverItemdeliverItem
    Message typeResponse message (Body)Request message (Body)Response message (Body)Request message (Body)Response message (Body)
    Message formatOutput dataStock allocation input dataStock allocation output dataDelivery arrangement input dataDelivery arrangement output data
  9. In the List Of Variables And Correlation Sets dialog box, click the OK button.
    The variables are now set.

    [Figure]

(4) Deploying activities

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

Table 5-10 Activities necessary for the business process of the HelloProductArrangement sample program

Value to be setDescription
Receive activityReceives a response from the service requester
Data transformation activityEdits input data, output data, stock allocation data, and delivery arrangement data
Invoke service activityCalls the stock management service or delivery reception service
Switch start activityStarts the processing selected according to the condition (whether the product is in stock)
Reply activityReturns the processing result to the service requester
Switch end activityEnds the processing selected according to the condition (whether the product is in stock)

The following shows the activity deployment procedure.

  1. Place activities on the canvas as shown in the following figure. To place an activity, click on it on the palette, and then click the position at which to place it on the canvas.

    [Figure]

  2. To connect activities, click Connection on the palette.
  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 end activity.
    Make sure that the activities are chained as follows.

    [Figure]

(5) Defining activities

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

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

    [Figure]

    ItemValue to be setDescription
    Activity nameReceiveEnter the name of the activity.
    Operation namearrangeItemSpecify the name of the operation that is used to call the stock management service 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 product arrangement 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 to enable initialization.
  3. Click the OK button.
(b) Data transformation activity (for preprocessing of stock allocation)
  1. Double-click the data transformation activity (DataActivity1) 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 nameStockAllocationPreprocessingEnter the name of the activity.
    Variable (in the Source Variables area)InputDataSelect the transformation-source variable from the drop-down list, and then click the Add button.
    Variable (in the Destination Variable area)StockAllocationInputDataSelect the transformation-destination variable from the drop-down list.
    DataTransDefnFileStockAllocationPreprocessingEnter the name of the data transformation definition file to be used to transform variables.
  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. Click the root element of InputData (schema logical name) for Source, and then, from the drop-down list, select ars:arrangeItem.
  6. Click the root element of StockAllocationInputData (schema logical name) for Destination, and then, from the drop-down list, select ims:reserveItem.

    [Figure]

  7. Click the OK button.
    The data transformation definition window appears.
  8. On the palette of the data transformation definition window, select Mapping.

    [Figure]

  9. Click the node adapter of the transformation-source node as the mapping source.
  10. Click the node adapter of the transformation-destination node as the mapping-destination.
    A mapping line is set. The correspondence between the mapping-source and mapping-destination node adapters is as follows.

    [Figure]

(c) Data transformation activity (in the case where the product is out of stock)
  1. Double-click the data transformation activity (DataActivity2) 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 nameOut-Of-Stock-SettingEnter the name of the activity.
    Variable (in the Source Variables area)StockAllocationOutputDataSelect 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.
    DataTransDefnFileOut-Of-Stock-SettingEnter the name of the data transformation definition file to be used to transform variables.
  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. Click the root element of StockAllocationOutputData (schema logical name) for Source, and then, from the drop-down list, select ims:reserveItemResponse.
  6. Click the root element of OutputData (schema logical name) for Destination, and then, from the drop-down list, select ars:arrangeItemResponse.

    [Figure]

  7. Click the OK button.
    The data transformation definition window appears.
  8. On the palette of the data transformation definition window, select Mapping.

    [Figure]

  9. Click the node adapter of the transformation-source node as the mapping source.
  10. Click the node adapter of the transformation-destination node as the mapping-destination.
    A mapping line is set. The correspondence between the mapping-source and mapping-destination node adapters is as follows.

    [Figure]

(d) Data transformation activity (for preprocessing of delivery arrangement)
  1. Double-click the data transformation activity (DataActivity3) 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 nameDeliveryArrangementPreprocessingEnter the name of the activity.
    Variable (in the Source Variables area)StockAllocationOutputDataSelect the transformation-source variable from the drop-down list, and then click the Add button.
    Variable (in the Destination Variable area)DeliveryArrangementInputDataSelect the transformation-destination variable from the drop-down list.
    DataTransDefnFileDeliveryArrangementPreprocessingEnter the name of the data transformation definition file to be used to transform variables.
  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. Click the root element of StockAllocationOutputData (schema logical name) for Source, and then, from the drop-down list, select ims:reserveItemResponse.
  6. Click the root element of DeliveryArrangementInputData (schema logical name) for Destination, and then, from the drop-down list, select dls:deliverItem.

    [Figure]

  7. Click the OK button.
    The data transformation definition window appears.
  8. On the palette of the data transformation definition window, select Mapping.

    [Figure]

  9. Click the node adapter of the transformation-source node as the mapping source.
  10. Click the node adapter of the transformation-destination node as the mapping destination.
    A mapping line is set. The correspondence between the mapping-source and mapping destination node adapters is as follows.

    [Figure]

(e) Data transformation activity (for setting a delivery number)
  1. Double-click the data transformation activity (DataActivity4) 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 nameDeliveryNumberSettingEnter the name of the activity.
    Variable (in the Source Variables area)DeliveryArrangementOutputDataSelect 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.
    DataTransDefnFileDeliveryNumberSettingEnter the name of the data transformation definition file to be used to transform variables.
  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. Click the root element of DeliveryArrangementOutputData (schema logical name) for Source, and then, from the drop-down list, select dls:deliverItemResponse.
  6. Click the root element of OutputData (schema logical name) for Destination, and then, from the drop-down list, select ars:arrangeItemResponse.

    [Figure]

  7. Click the OK button.
    The data transformation definition window appears.
  8. On the palette of the data transformation definition window, select Mapping.

    [Figure]

  9. Click the node adapter of the transformation-source node as the mapping source.
  10. Click the node adapter of the transformation-destination node as the mapping destination.
    A mapping line is set. The correspondence between the mapping-source and mapping destination node adapters is as follows.

    [Figure]

(f) Invoke service activity (for stock allocation)
  1. Double-click the invoke service activity (InvokeActivity1) 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 nameStockAllocationEnter the name of the activity.
    Service nameStockManagementFrom the drop-down list, select the name of the service component to be called by sending a request message.
    Operation namereserveItemAmong the operations for the service component (stock management) specified in Service name, select the name of the operation that is to be called.
    Communication modelSyncThe communication model set for the operation specified in Operation name is displayed.
    Body allocated variable (in the Request message area)StockAllocationInputDataFrom 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)StockAllocationOutputDataFrom 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.
(g) Invoke service activity (for delivery arrangement)
  1. Double-click the invoke service activity (InvokeActivity2) 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 nameDeliveryArrangementEnter the name of the activity.
    Service nameDeliveryReceptionFrom the drop-down list, select the name of the service component to be called by sending a request message.
    Operation namedeliverItemAmong the operations for the service component (delivery arrangement) specified in Service name, select the name of the operation that is to be called.
    Communication modelSyncThe communication model set for the operation specified in Operation name is displayed.
    Body allocated variable (in the Request message area)DeliveryArrangementInputDataFrom the drop-down list, select the variable to be allocated to the body of the request message that calls the delivery arrangement 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 delivery arrangement service. This item is not used for this sample program. Therefore, do not set this item.
    Body allocated variable (in the Response message area)DeliveryArrangementOutputDataFrom 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.
(h) Reply activity (if the product is out of stock)
  1. Double-click the reply activity (ReplyActivity1) on the canvas.
    The Reply Activity dialog box appears.
  2. Enter information as shown in the following figure.

    [Figure]

    ItemValue to be setDescription
    Activity nameReply_Out-Of-Stock-ErrorEnter the name of the activity.
    Operation namearrangeItemSpecify 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 for the business process.
    Header allocated variableNoneSet this item when you allocate a variable to the header of the response message for the business process. This item is not used for this sample program. Therefore, do not set this item.
    Correlation set groupNoneEnter 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.
(i) Reply activity (in the case where delivery arrangement is successful)
  1. Double-click the reply activity (ReplyActivity2) on the canvas.
    The Reply Activity dialog box appears.
  2. Enter information as shown in the following figure.

    [Figure]

    ItemValue to be setDescription
    Activity nameReply_Arrangement-SuccessEnter the name of the activity.
    Operation namearrangeItemSpecify 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 for the business process.
    Header allocated variableNoneSet this item when you allocate a variable to the header of the response message for the business process. This item is not used for this sample program. Therefore, do not set this item.
    Correlation set groupNoneEnter 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.
(j) Switch start activity
  1. Double-click the switch start activity (SwitchStartActivity1) on the canvas.
    The Switch Activity dialog box appears.
  2. Enter CheckStockAllocationResult as the activity name.
  3. Click the line on which the value of the Transition destination column is Out-Of-Stock-Setting. Then, click the To Upper button to move the line to the top line.
  4. Select the top line, and then click the Condition Setting... button.
    The Set Condition dialog box appears.
  5. Enter information as shown in the following figure.

    [Figure]

    ItemValue to be setDescription
    Condition nameOut-Of-StockSpecify the condition for determining whether the product is out of stock as a result of a stock allocation check.
    Variable contentsStockAllocationOutputDataFrom the drop-down list, select the variable to be used in the condition expression.
    Condition expression

    csc:getVariableData("StockAllocationOutputData", "/*[local-name()
    ='reserveItemResponse' and namespace-uri()
    ='http://sample/InventoryManagementService']/*[local-name()
    ='ReservationNumber' and namespace-uri()
    ='http://sample/InventoryManagementService']")="*"

    Specify the condition expression for determining whether the product is out of stock in XPath expression format.
    Note:
    Line breaks are not applied to the displayed condition expression.

  6. Click the OK button.
    The Switch Activity dialog box appears again.
  7. On the line on which the value of the Transition destination column is DeliveryArrangementPreprocessing, click Priority, and then select Default from the drop-down list.
    If you select Default, you do not need to specify the condition settings.

    [Figure]

  8. Click the OK button.
(k) Switch end activity
  1. Double-click the switch end activity (SwitchEndActivity1) on the canvas.
    The details of the switch end activity are displayed in the properties view.
  2. Enter CheckStockAllocationResult_End as the activity name.

    [Figure]

  3. When you have defined all activities, from the menu, select File and then Save. The business process is now defined.