Wednesday, 17 July 2019

Call External REST API: Oracle Integration Cloud

In this article, we'll show how to call External REST API in Oracle Integration Cloud using the REST Adapter.

Consider we need to consume the third party application REST API in OIC. The REST adapter will help to invoke external APIs.

For the time sake, we will consume the publicly available REST API in OIC. So let's get started and see how to call this.

Creating a REST Connection
  • Create a REST connection with name External_REST_Conn and select the Role as Invoke
  • Click the Configure Connectivity button, enter below details as below and click the OK button:
  • Click on the Configure Security button. From the popup, select the No security Policy from the Security Policy drop-down and click the OK button

Rest connection configuration is completed now. Just test the connection and Close

Create the Orchestrated Integration
  • Create an Orchestrated Integration
  • Drag and Drop the REST adapter(The REST adapter should be of Trigger type) as a Source and configure below properties from the first screen
    • What do you want to call your endpoint? GetTodos
    • What is the endpoint's relative resource URI: /mytodos
    • What action do you want to perform on the endpoint? GET
    • Select Configure this endpoint to receive the response checkbox
  • From the Response screen select below and click the Next button
    • Select JSON Sample from the Select the response payload format drop-down
    • Select the <<<inline>>> link, enter below JSON and click the Ok button
[
  {
    "MyUser": 1,
    "MyId": 2,
    "Mytitle": "My title",
    "IsCompleted": false
  }
]

  • Finish the REST wizard by clicking the Finish button
  • Drop the Rest adapter (External_REST_Conn) we created in the previous step ad configure  below properties from the first screen
    • What do you want to call your endpoint? CallTodos
    • What is the endpoint's relative resource URI: Enter the relative URL of the third party application REST API. In this case, it is /todos
    • What action do you want to perform on the endpoint? Since the third party service is of GET type hence select GET
    • Select Configure this endpoint to receive the response checkbox
  • From the Response screen select below and click the Next button
    • Select JSON Sample from the Select the response payload format drop-down
    • Select the <<<inline>>> link, enter below JSON and click the Ok button
This should match the exact JSON as we are getting response from the third party application REST API

[
  {
    "userId": 1,
    "id": 1,
    "title": "delectus aut autem",
    "completed": false
  },
  {
    "userId": 1,
    "id": 2,
    "title": "quis ut nam facilis et officia qui",
    "completed": false
  }
]

  • Finish the REST wizard by clicking the Finish button
  • Edit the GetTodos mapper and map fields as below
Source
Target
topLevelArray
topLevelArray
Userid
MyUser
Id
MyId
title
Mytitle
completed
IsCompleted


We are ready with the integration. Save, close and Activate the integration. Take the OIC REST API URL which got generated and hit the URL in the browser directly and check the response.


Thursday, 4 July 2019

How to build approval process: Oracle Process Cloud

This blog will show the step-by-step process on how to create a process which involves a start activity, decision flow, human task, end event, etc in Oracle Process Cloud. We will use the "Form Approval Pattern" to develop the process and edit it as per our business need.

In this article, we will create a Loan Processing application in which user fills the loan application which goes to the approver if the loan amount is greater than >100 else the loan application will be auto-approved.

In the previous article, we showcased how to develop a simple process from scratch.

Some blogs on Oracle Process Cloud:

Enable notification in 5 minutes: Oracle Process Cloud Service

Setting to enable the notification in Oracle Process Cloud Services


The process will look like below at the end of this article.


Let’s see how to use “Form Approval Pattern” in Oracle Process Cloud.
  • Create a process with the name “Loan Process Application
  • Select “Form Approval Pattern
  • Enter process name as “LoanProcess”, select Open Immediately checkbox and click on Create button
  • The Form Approval Pattern will look like below by default but same can be modified as per the requirement
  • Expand “Gateways” in the Elements Palette and drop Exclusive between the “Submit Request” and “Resubmit” activity and rename it as “TakeDecision
  • Restructure the sequence flow as Submit Request to TakeDecision, TakeDecision to Completed and TakeDecision  to Approve Request as shown in the below screenshot
  • Select Submit Request flow activity, click Menu and click “Open Properties
  • In the Implementation tab, enter Title as “Loan Process Form,” click on the + from the Form. In the Create New Web Form dialog box, enter the name as "LoanForm", select “Open Immediately” checkbox and click on the Create button
  • In the Web Form Designer, drag & drop controls on the form page and rename them as below
Control Name
Name
Label
Select
LoanType
Loan Type
Input Text
FirstName
First Name
Input Text
LastName
Last Name
Email
Email
Email
Amount
Amount
Amount
Select
Tenure
Tenure in months

  • Select Loan Type, see the Properties tab left-hand side and go to the Option Source properties, enter below Option Names and Option Values
Option Names
Option Values
Car Loan
CarLoan
Home Loan
HomeLoan
Personal Loan
PersonalLoan

  • Same ways, select Tenure in month control and enter option names and option values from 1 to 24
  • Go back to the “LoanProcess” tab, select the sequence flow between TakeDecision and Complete flow elements, click on the edit button
  • In the Implementation tab, Enter Name as “ApprovalNotRequired”, select the Conditional Flow Checkbox, Click the edit button in front of the condition text box. From the opened popup, Insert the loanFormDataObject.amount<=100 expression and click on the OK button
  • Select the sequence flow between TakeDecision and Complete flow elements, click on the edit button. Make sure the Conditional Flow Checkbox is unchecked
  • Edit the Human Task now, click on the Approve Request, click on the menu and click “Open Properties”. In General, tab, enter the following values:
    • Form: Browse the LoanForm
    • Title: Enter the expression as "Loan approval is required for amount " + LoanForm.amount
    • Task Summary: Enter the expression as "Dear Sir/Madam, Please approve the loan for "+LoanForm.firstName+" "+LoanForm.lastName

  • Select the sequence flow between “Approved” and “Fulfill” and click on the edit button. Select the Conditional Flow checkbox and enter expression as TaskOutcomeDataObject=="APPROVE"
  • Select the sequence flow between “Approved” and “Resubmit” and click on the edit button. Uncheck the Conditional Flow checkbox
  • Select Resubmit flow element, click menu and Open Properties. Browse LoanForm in the Form text box
  • Select Fulfill flow element, click menu and Open Properties. Browse LoanForm in the Form text box

The process is completed and its time to test the process.
  • On the application toolbar, click Test button and then click on the Activate button. In the Deploy to Test dialog box, ensure the Add Me to All Roles option is selected and click on the Activate button

Here we will execute two test cases:
  1. Enter the loan amount less than 100 from the loan web form and see the loan must be auto-approved without going to the approval process
  2. Enter loan amount greater than 100 from the loan web form and see the loan must follow the approval cycle

Test-1 
  • Click on the Play button and click on the LoanProcess

  • Click the Play icon displayed over the Submit Request element. In the Play dialog box, select a user, and click Play
  • In the Start Application for LoanProcess form, enter appropriate values in the fields and click the Submit button. For example:
    • Loan Type: Car Loan
    • First Name: Ankur
    • Last Name: Jain
    • Email: a@gmail.com
    • Amount: $90.00
    • Tenure in months: 1
See the path in red which shows the path of the whole process took to complete. As the Amount entered was less than 100, the loan has been approved without any approval


Close the LoanProcess tab now


Test-2
  • Click on the Play button again and click on the LoanProcess
  • Click the Play icon displayed over the Submit Request element. In the Play dialog box, select a user, and click Play
  • In the Start Application for LoanProcess form, enter appropriate values in the fields and click the Submit button. For example:
    • Loan Type: Home Loan
    • First Name: Deepak
    • Last Name: Kumar
    • Email: d@gmail.com
    • Amount: $300.00
    • Tenure in months: 7

  • The request has gone for the approval, now click on the Approve Request, click on the user name and then play button. Click the Approve button
  • Now the request has been approved so it will follow the approval path and now the request will go to the Fulfill activity
  • Click on the Fulfill activity, click on the user name and then play button. Click the Submit button
  • Process is completed

Tuesday, 2 July 2019

How to invoke an Integration from another Integration: Oracle Integration Cloud

In this blog, we are going to showcase how to call an existing integration from another integration without creating a separate connection. This feature is available in the OIC version 18.3.1 onwards. This feature is available using the feature flag "oic.ics.console.integration.invoke.local.integration"

Please go through the blog which helps you to see the feature flag functionality in Oracle Integration Cloud.

Will create a new REST API which will call existing Integration SAMPLE_REST. 

This  SAMPLE_REST is the rest API which takes one request parameter(name) and gives the response in JSON.

Below is the structure of SAMPLE_REST integration:

Request URL:

https://techsupper.integration.ocp.oraclecloud.com/ic/api/integration/v1/flows/rest/SAMPLE_REST/1.0/get?name=Ankur

Response:

{
  "greeting" : "Hi Ankur"
}

Only the active integration can be called from the Integration so activate the integration SAMPLE_REST

Let's create the caller integration
  • Create an orchestration integration with the name InvokeIntegration
  • Drop the REST adapter as a Trigger, enter information as below and click the Next button
    • What do you want to call you endpoint: CallInt
    • What is the endpoint's relative resource URI: /call
    • What action do you want to perform on this endpoint: GET
    • Select the Add and review parameters for this endpoint checkbox
    • Select Configure this endpoint to receive the response checkbox
  • Add one parameter(UserName) of string type and click the Next button
  • Select the JSON sample from the drop down and enter below json using the <<<inline>>> option
{
  "usergreeting" : "Hi Ankur"
}

 
  • Expand the Actions menu from the right panel, Drag the Integration activity and drop just below the REST adapter
  • Enter the endpoint name as CallIntegration and click the Next button
  • The next page shows all the activated integration. Select the Integration(Sample_Rest) and click the Next button
  • Select the Operation and click the Next button
  • Edit the CallIntegration mapper
  • Map the username to name and close the mapper
  • Edit the CallInt mapper and map gretting to usergreeting
  • Now save, close and Activate the integration. Hit the REST endpoint using the endpoint URL and see the response
  • Go to the Monitoring -> Tracking and see the InvokeIntegration should get hit. Open the instance and see the CallIntegration activity should be in green which means the Sample_Rest integration called successfully