Global Variables and Data Stitch in Oracle Integration
This article covers the two most important features which Oracle announced recently. One of the features allows us to create Global Variables that are available throughout the integration. The feature is part of feature flag “oic.ics.console.integration.complex-variables“. The variable can be one any types as below:
- String
- Boolean
- Date
- Date Time
- Object
- Number
- Another feature is Data Stitch which allows us to create assignments of complex type (Object) variables. This feature is part of feature flag “oic.ics.console.integration.stitch-action“.
The minimum Oracle Integration version required for the feature is 200113.1400.33493.
Enable two feature flag on your OIC instance to enjoy these features:
- oic.ics.console.integration.stitch-action
- oic.ics.console.integration.complex-variable
Few important articles which may help you
Features Flag in Oracle Integration Cloud
Automate ERP Purchase Order creation using Oracle Integration
Let me help you with an example of how these two features can help.
Let’s suppose you are exposing a REST that sends the file name as a request parameter and wanted to read the file from the FTP location and send the data in the REST service response. To handle exception scenarios, you can use Scope activity and configure the FTP adapter under Scope. Since Scope activity is a block and whatever variable you create or invoke any activity under the scope, the visibility of these variables, invoke responses are limited to the Scope only. What if you wanted to use the response of invoke outside the Scope. This is where the Global Variable and Data Stitch activity will help.
See how to use both features in a single integration.
Created a REST API with request template parameter file-name and response as JSON
{
"FirstName":"",
"LastName":""
}
Under the Scope activity, configured the FTP adapter read file from FTP location and mapped the file-name parameter with FTP header in mapper. After this integration will look like below.
Open the DataStich mapper at the end of the integration. Open this mapper and you will not see the read response of FTP. So let’s try to solve this problem.
Global Variable
Let’s add a Global variable and create this is of an Object type. Click on (X) Global variable from the right panel and click on “Add Variable“. Name the variable name as “FTPResponse” and select Type as Object.
Once you select the Type as Object, it will open the Source section which allows you to select the type of Object. From the Source section, select $FTPRead/SynchReadFileResponse/FileReadResponse/Employees
One of the Global Variable with the name “FTPResponse” has been created of complex Type Employees.
Data Stich
From the Action pallet, Drop the Data Stich activity just below the FTP adapter.
In the properties section, enter a name as “ConfigureFTPResponse” and click on the Configure button.
Once you click on the Configure button, it will allow the assignment. Select “FTPResponse/Employees” (this is the Global variable created in the previous step) in the variable section, select Assing as Operation. Click Value section which will open available sources which you can use to assign to ” FTPResponse/Employees “, click Browse All Data to see all sources. From the Sources section, drop Employees to Variable.
Click X sign to close this. Edit the last mapper “DataStich” and map the data as per below table:
Source | Target |
---|---|
$FTPResponse/nsmpr1:Employees/nsmpr1:Employee/nsmpr1:FirstName | /nstrgmpr:executeResponse/ nstrgdfl:response-wrapper/nstrgdfl:FirstName |
$FTPResponse/nsmpr1:Employees/nsmpr1:Employee/nsmpr1:LastName | /nstrgmpr:executeResponse/ nstrgdfl:response-wrapper/nstrgdfl:LastName |
Here we have used the FTP invoke response outside the Scope activity. Test the integration and see the file data should come as part of the REST response.
Check the complete video on Global Variables and Data Stitch.
See my YouTube channel to learn new things in OIC space.