Cloud Pak for Business Automation

 View Only

TECHNICAL RECIPE - Calling IBM ODM Decision Service from IBM Business Automation Workflow

By Vivek Satwal posted Wed September 28, 2022 12:04 PM

  

Objective

To demonstrate how you can use the IBM Operational Decision Manager decision service in IBM Business Automation Workflow.

Technical Component

  1. IBM BAW / WFPS/ Business Application
  2. IBM ODM

Prerequisite

  1. IBM BAW is installed
  2. IBM ODM is installed
  3. IBM BAW can access the IBM ODM system via external service

Steps

  • Retrieve the Hosted Transparent Decision Service in IBM ODM Rule Execution Server.

 

  1. Login to the Rule Execution Server console then navigates to the Ruleset View of the project you want to use.
  2. Click Explorer where you can browse the deployed RuleApps.

  1. In RuleApps View, click <<Test_RuleApp>>.

 

  1. On the upper right corner of the Ruleset View, click Retrieve HTDS Description File.
  2. Select REST for the service protocol type then select OpenAPI — JSON for the Format. Choose the Latest ruleset version and Latest RuleApp version.
  3. Click Download to save the file locally or click View and copy the URL.

 

  • Invoke ODM Decision Service from BAW

  1. Create an External Service to Discover ODM Decision Service
             1.1. In the ODM Integration TK navigator, go to Services and then click the plus icon (+) to create a new External Service.
            

            1.2. In the New External Service window, select Java, REST or Web service and then click Next.
            

            1.3. Select REST service from a local file — select an OpenAPI (Swagger) file on your local file system.
           

            1.4. In the list of discovered operation’s, select the operation’s you want to include in the external service and then click Next.
            


            1.5. Set the server that contains the properties used to invoke the REST service. Select Create a new server and click Finish
            
 
            1.6. Once done creating the external service, check the generated artifacts: several business objects and an external service.
           

            1.7. To verify the configured server, go to Toolkit Settings > Server and check the server details.
            1.8. To authenticate the user, select basic authorization as an Authentication. Provide authentication details as shown in below figure.
            

           

Reminder: From the Servers tab, you can add server configurations for Development, Test, Staging, and Production environments so you can connect to the ODM Rule Execution Server instance of the respective environments. Click the plus icon (+) to add a new server configuration.

Now, we will define BAW services to use ODM Decision Service integration.

 

  1. Use the External Service in a Service Flow 
            2.1. In the ODM Integration Toolkit navigator, go to Services and then click the plus icon (+) to create a new Service Flow.
           

            2.2. Enter the name of the service and click Finish.
           

            2.3. Drag into the diagram the created external service and change the name of the service task.
           

            2.4. Set the Implementation by clicking service task and under Properties, click Implementation. Select the operation using the dropdown.
           

            2.5. Set the Data Mapping of service task. Under Properties > Data Mapping, set the input and output mapping using the auto-map.
            

            2.6. Check the created private variables in the Variables tab and expand each variable. The Request variable has two parameters that the ODM Decision                      Service needs as input.

           

 

NOTE: DecisionID parameter is optional which can be used for tracking purposes. Rule Execution Server generates a unique ID when the ID is not specified. DecisionID is used to identify the transparent decision service that your request defines. If you want to provide a DecisionID, make sure that the ID is unique to avoid conflicts with the element/s implemented in Rule Execution Server.

           2.7. Click on run icon  (top right side play icon) , to test the Service Flow.
          

 

Congratulations! You have successfully integrated IBM Operational Decision Manager Decision Service from IBM Business Automation Workflow.

References

  1. https://www.ibm.com/docs/en/baw/19.x?topic=services-calling-external-service
  2. https://www.ibm.com/docs/en/odmoc?topic=modeling-task-1-creating-decision-model-service
  3. https://www.ibm.com/community/automation/docs/odm-2/business-operations-connect/decision-connect/how-to-expose-the-api-of-an-executable-decision-service-in-odm-with-a-swagger-description/
2 comments
27 views

Permalink

Comments

Thu September 29, 2022 06:28 AM

Good. Thanks for sharing.

Thu September 29, 2022 01:17 AM

Nice and useful content