Data Stitch and Global Variables in OIC
In this post, we will look at 2 new Integration features Data Stitch and Global Variables. Data Stitch allows us to make assignments to complex type variables. Below is the use case,- Accept multiple country codes as input.
- For loop
- Retrieve the country details from an REST API.
- Use Data Stitch to collate the response (in a temporary variable)
- Assign the Response from temporary variable.
https://restcountries.eu/rest/v2/alpha/{code}
Prerequisite:
Enable following features:
- oic.ics.console.integration.stitch-action
- oic.ics.console.integration.complex-variables
The minimum Oracle Integration version required for the feature is 200113.1400.33493
Global Variables are visible anywhere in the integration, including fault handlers.
Creating REST Connection
Creating a SOAP Connection
I have used a schema which will look like below for the above soap connection.Create your own wsdl with below elements in request and response.
Creating the App Driven Integration
Drag and Drop the SOAP Connection Created and configure the details.
Now drag and Drop the REST Connection to configure the details.
Please make sure to select the highlighted checkbox
You have to select JSON Sample and click on inline to enter the sample response.
You can take the RESPONSE EXAMPLE from this site. https://restcountries.eu/
Now drag and drop the For Each activity right after the first task.
I have changed the Layout to Horizontal.
Reposition the Map and Rest Invoke inside the For each.
Now lets create a Global variable,
Name the Variable as tempResponse and Type as "Object".
Select the response of this SOAP interface. This variable will be used along with data stitch.
Now lets map the request for REST API as below.
Drag and drop a new Map activity after the REST Invocation.
The response mapping will be something like below.
Note: The variable you see in the target is the actual response element of this interface, not the temp variable we created.
Now drag and drop the Data Stitch activity, right after the mapping(inside the for each).
Name the activity and click configure.
Now we have to copy/append the data from CountryDetails_Response (which was mapped in previous activity) into tempResponse variable.
You can use Data Stitch to Overwrite the values as well, it has 3 options
- Append (shown in this example)
- Assign (Overwrite values in a complex element)
- Remove (Delete an element from a complex element)
And in the Map activity after ForEach, we will take the data from tempResponse and map it to response element of this interface.
Now activate the interface and test it from SOAP Ui.
Awesome blog...
ReplyDeleteVery good info 🙏
ReplyDeleteHi Prabakaran,
ReplyDeleteVery nice and crisp article.
This feature is really useful and its actually inspired from "Variables" feature of On Prem SOA and SOACS.
We can at max have 20 variables of such.
While doing exception handling we can access these variables unlike before.
Can you kindly add these info in this post too.
Regards,
Deb