' oicbasics: October 2020
October 29, 2020

Global Variable and Data Stitch | Oracle Integration Cloud



In this article I have tried to explain how we can use Global Variable and Data Stitch Action in an Integration.


About Global Variable : You can create complex and simple type global variables that are available for usage throughout an orchestrated integration (for example, when building an expression in the Expression Builder of an assign action).

User-defined complex type variables are defined based on the WSDLs/XSDs exposed in the integration by the trigger connection and any invokes connection. These variables are then be available throughout the integration for assignment and usage.

About Data Stitch Action :  You can incrementally build a message payload from one or more existing payloads with the stitch action. The stitch action provides an editor that enables you to assign values to variables. The stitch action supports both partial and full replacement of the message payload. The stitch action also supports both scalar and complex type variables.



- Advertisement -


How Data Stitch and Global Variable can help ? 

Lets take one case scenario : 👉 
Suppose your requirement is to map the response of FTP read operation out of its scope. In this case you can use Data Stitch action along with Global Variable to fulfill this requirement.



Another case scenario : 👉 
You can map response from one switch flow inside another switch flow using Stitch Action.



Above two case scenario are just the basic use of Stitch Action & Global Variables but you can perform many complex operation using Stitch Action and Global Variables

You can perform the following complex assignments (operations) on variables (and child elements of variables) with the STITCH ACTION :👀

• Append: Appends at the end of the repeating/unbounded target element, the selected element, or the value. For example, you have an existing purchase order payload containing five lines and want to add a sixth line. The stitch action enables you to append a sixth line to the existing array of lines in the purchase order.
• Assign: Places the selected value/element/attribute into the target element/attribute, overriding any existing data in the target element/attribute. For example, you want to change the current address in an existing purchase order. The stitch action enables you to change the address. You can either map fields individually or copy the address object itself.
• Remove: Removes the target element/attribute from the variable. For example, you have an existing purchase order payload and want to remove the price to enable the end point application to calculate a new price. The stitch action enables you to remove the price. For repeating/unbounded elements, all instances are removed unless a specific instance is selected by index or predicates.





Hands-on Practice : 

Lets develop one Integration using global variables and data stitch action :

Use Case :  Will use Data Stitch Action along with Global Variable to map FTP read operation response out of its Scope.

**Prerequisite :  REST Trigger and FTP Server Connection. If you don't have these connection available in your OIC Instance you can follow the below links and can configure the same.


Step 1 : Create one App Driven Integration.



Step 2 : Search for REST Trigger connection and select the it (in my case it's 'REST_Conn') and configure it by providing basic detail along with Request and Response payload. 




- Advertisement -



  • Enter any meaningful name


  • Enter details as shown in below image and click Next


  • Enter below Request Sample JSON Payload and then click Ok.
{
  "File Metadata" : {
    "File Name" : "",
    "Directory Path" : ""
  }
}


  • Enter below Response Sample JSON Payload and click Ok.
{
  "Employee" : {
    "EmployeeDetail" : [ {
      "Name" : "",
      "Id" : ""
    } ]
  }
}

  • Click done.

Step 3 : Add one Scope 





- Advertisement -





Step 4 : Add the FTP Connection. In my case it's "FTP_Test".

  • Enter a meaningful name 
  • Enter operations details and then click NEXT:
    • Select Operation : Read a File
    • Select a Transfer Mode : Binary
  • Select "Sample delimited document (e.g CSV) " option and then click Next .




- Advertisement -



    • Enter the Record Name  : Employee  (you can give any meaningful name)
    • Enter the Recordset Name. : EmployeeDetail
    • Select the  Field  Delimiter : comma(,)
    • Charter Set : UTF8
    • Optionally Enclosed By : "
    • Terminated  By : ${eol}
    • Select use first Row as column header
  • Click Done
  • Open mapper and map the Input with FTP request




NOTE : Now if you open the mapper to map the response of FTP output you can see that FTP response is not available. You Know why ? because FTP adapter is inside a scope.





- Advertisement -







Declare Global Variable and Data Stitch : 


STEP 5 : Click on '(x)' icon present at right hand side and then click 'Add Variable'



  • Configure below detail :
    • Name  : global_var_readFileResponse (you can give any meaningful name )
    • Type : Select Object type


  • Select "SyncReadFileResponse*" from $readFileFromDirectory as object. And then click close icon(X). It will automatically get saved.
    [You can take reference from below image]






- Advertisement -





STEP 6 :
Now lets add Data Stitch action inside Scope

  • Give any meaningful name and then click Configure


  • Search for the global variable which we have declared above (Step 5) and then select it.


  • Select Operation = Assign and Value (x) = select the FTP  response as shown in below image

 

Knowledge :👀

You can perform the following complex assignments (operations) on variables (and child elements of variables) with the stitch action:
Append: Appends at the end of the repeating/unbounded target element, the selected element, or the value. For example, you have an existing purchase order payload containing five lines and want to add a sixth line. The stitch action enables you to append a sixth line to the existing array of lines in the purchase order.
Assign: Places the selected value/element/attribute into the target element/attribute, overriding any existing data in the target element/attribute. For example, you want to change the current address in an existing purchase order. The stitch action enables you to change the address. You can either map fields individually or copy the address object itself.
Remove: Removes the target element/attribute from the variable. For example, you have an existing purchase order payload and want to remove the price to enable the end point application to calculate a new price. The stitch action enables you to remove the price. For repeating/unbounded elements, all instances are removed unless a specific instance is selected by index or predicates.


  • Close the configuration window by clicking 'X'. It will get saved automatically

  • Now Open the "GetFileData" mapper and map the output with data stitch 





- Advertisement -





STEP 7 :
Enable the Tracker



  • Click Save and Close the integration. 





- Advertisement -




Testing Steps :

  • Put .csv file in your FTP server directory. In my case I am putting file at "/" root directory having file name "DataStitch.EmpDetail.csv"

  • Activate the integration


  • Click Run button
  • Enter the request JSON payload by entering your input data. Like Your .csv file name and your file directory path.
{
  "File Metadata" : {
    "File Name" : "DataStitch_EmpDetail.csv",
    "Directory Path" : "/"
  }
}

  • You can see the output in response window.


- Advertisement -




Thank You !  😊



October 7, 2020

Configure OTM connection in OIC


In this blog I have described the steps to configure the OTM connection in Oracle Integration Cloud Instance.


STEPS OVERVIEW : -

Step 1 : Configure OTM Connection using Logistics adapter.
Step 2 : Upload OTM SSL Certificates.


Prerequisite : Requesting you to follow this blog & download the OTM SSL certificates files. We need it in below steps.



Knowledge :👀
Certificates are used to validate outbound SSL connections. A certificate enables Oracle Integration to connect with external services. If the external endpoint requires a specific certificate, request the certificate and then upload it into oracle integration.





Steps in detail : 

STEP 1: Steps to Configure OTM Connection: 


  • Go to Connection Tab and create New Connection

  • Search for LOGISTICS adapter and select it

  • Give connection a meaningful name and click create

  • Fill the below details :
    • *WSDL URL : Enter the OTM Transmission Service WSDL URL or you can upload its WSDL file also.
    • SECURITY : Enter the OTM user credentials. Make sure the user has the required roles assigned. Otherwise you may receive Authentication Error.

  • Click Save and Test the connection. Your OTM connection configuration completed.


STEP 2: Steps to upload SSL certificate:


Prerequisite : If you don't have downloaded the certificate files yet, requesting you to follow this blog & download the OTM SSL certificates files. We need it in below steps.

  • In the left navigation pane, click Home > Settings >Certificates


  • Click Upload at the top of the page
  • Enter an alias name and optional description
  • In the Type field, select the certificate type = X.509 (SSL transport) and Category = TRUST




Knowledge :👀
X.509 (SSL transport ) - Select a certificate category :

Trust: Use this option to upload a trust certificate. Click Browse, then select the trust file(example - .cer or .crt) to upload.

Identity: Use this option to upload a certificate for two -way SSL communication.
1. Click Browse, then select the keystone file (.jks) to upload.
2. Enter the comma-separated list of passwords corresponding to key aliases.
3. Enter the password of the keystore being imported.


October 6, 2020

Send attachment in OIC notification


In this post I have explained how to send Attachments along with notification's body in OIC Notification action.

Knowledge :👀
The total size limit on a notification email is 1 MB for Oracle Integration and 2 MB for Oracle Integration Generation 2.


Steps overview to send attachment in OIC notification action  :

  • Open the Notification action and click on Plus  icon "+" to add attachments. 
  • Select the Attachments ( 'Reference' )to add.You can edit or delete the attachment once added. Click save and close.That's it. Your configuration for sending attachment in email notification completed.

 [You can take reference from below image:- Fig -1, Fig -2, Fig-3]



Info 👉  File Reference are of different types.For example, in the below image the  integration includes three file reference attachments (highlighted in yellow) that are available for selection. You can select one or all as attachments.

  • An attachment from a REST Adapter connection
  • A file reference from a stage file write operation ⃕this case scenario I have covered in below hands-on practice.
  • A file reference from an FTP Adapter download operation






#Hand-On Practice : 


Use Case : Lets develop one simple APP DRIVEN ORCHESTRATION integration which can take some JSON inputs and that inputs will get send as an attachment in email notification in XML format.


Top view of integration which we are going to develop :




Lets see the steps in detail :

Step 1 : Crate one APP DRIVEN ORCHESTRATION by giving Integration a meaningful name. 

Select any REST Trigger connection and configure the adapter as shown below -



  • Enter a meaningful name and then click Next



  • Give a meaningful endpoint's Resource URI (I have given /employeeDetail), Select Action = POST, Select REQUEST , RESPONSE options to configure. Click Next
          [You can take reference from below image]



  • Configure the Request Sample JSON Payload window by entering below JSON and then click Ok.Click Next
{
  "Employee" : {
    "EmployeeDetail" : [ {
      "Name" : "Amit",
      "Id" : "01"
    }, {
      "Name" : "Rohit",
      "Id" : "02"
    } ]
  }
}


  • Configure the Response Sample JSON Payload window by entering below JSON and then click Ok.Click Next
{
"Message" : "Success"
}


  • REST adapter configuration completed.Click Done.


STEP 2 : Now add Stage File Action and configure the adapter as shown below 


  • Enter a meaningful name , click Next




  • Configure the Stage File Action parameters window as given below :
    • *Choose Stage File Operation : Write File
    • *Specify File Name : enter any meaningful name (I have given "Employee.xml")
    • *Specify Output Directory : enter any meaning directory path (I have given "/EmployeeDetail")

  • In this window select XML Schema (XSD) Document.Click Next


  • Download the below schema file and choose the same file 


  • Stage File Action configuration completed. Click Done.

  • Open the mapper to map the value


  • Do the one to one mapping as shown in below image. Make sure to add For Each in mapper.Click Validate and close the mapper.




STEP 3 : Add Notification Action in the flow and configure it as shown in below steps



  • Enter the basic details -- *FROM, *TO EMAIL ids, *Subject , *Body and then click "+" icon of attachments 
Knowledge :👀
You can configure the approval email address to use in the FROM field on the notifications page that is accessible from Settings → Notifications.




  • Drag and drop the *FileReference element inside the expression box. Click Validate and Close.


  • Again click Validate and Close.


STEP 4 : Edit the response mapper of integration and just hardcode "Success" message as a final integration response.

[as shown in below image]

  • Click Validate and close.



STEP 5 : Enable Tracking for the integration



  • Click Save and Close the integration . Integration is ready to TEST.



UNIT TESTING : - 

  • Activate the Integration

  • Click RUN icon (as shown in below image)

  • Pass the below JSON as Input Payload and then Click TEST
{
  "Employee" : {
    "EmployeeDetail" : [ {
      "Name" : "Ramlal",
      "Id" : "01"
    }, {
      "Name" : "ShyamLal",
      "Id" : "02"
    },{
      "Name":"Ramabai",
      "Id":"03"
    } ]
  }
}


  • You can see "Success" response in downward response window.
  • Now check your email. You have received one email notification with payload as shown below :
    • Email Notification along with attachment


    • Attachment payload with the data which we have sent as input



Thank you :)


Top