December 22, 2020

Configure REST Trigger Endpoint to Get CSV Data


In this blog we will see the steps to configure REST Trigger (Source) Endpoint which can receive CSV data as Input from any source system (ex : from WMS System) and do the data processing as require further.


Click to Zoom Out


Lets see the Steps in Detail by doing one end to end POC.

Use case : We will create one Integration that can receive CSV data as Input and then Log the same data using Logger Action. 


Step 1 : Create one App Driven Orchestration Integration 



Knowledge :  👀 
App Driven Orchestration ? : It enables you to create an integration that uses an event or business object to trigger the integration. It is a Multi-step Integration flow invoking applications, integrations and processes triggered by an Application or API.


Step 2 :
Add Rest Trigger Connection type. You can follow this blog to create Rest Trigger Connection. 



  •  Enter any meaningful name and then click Next
  •  configure this window as suggested below :
    • *what is this endpoint's relative Resource URI ? : /csvdata (you can enter any meaningful URI)
    • *What action do you want to perform on this endpoint : POST
    • Select configure a request payload for the response and then click Next
  • Now configure the Request Payload as suggested below
    • Select the request payload format : Binary
    • What is the media-type of Response Body ? (Content Type Header) : Select Other Media Type 
    • ︖ Media Type. : Enter text/plain
  • Rest Endpoint configuration completed. Click Done

Step 3 : Now in this step lets configure one Stage File Action to read the received csv file data.

  • Add Stage File activity



Knowledge :  👀 
Stage File Activity ? : It provide access to the Integration Cloud local file system server.  Using this activity you can Read,Write,List,Zip,Unzip etc. files that are already present in the local file server. You can use any of these operation by providing the File Name and its Directory Path.


  • Enter any meaning full name and click Next


  • Configure the stage File Action parameter as suggested below
    • *Choose the Stage File Operation : Read Entire File
    •  Configure File Reference : Select Yes
    • *Specify the File Reference  : Click Edit (Pencil icon) and then drag and drop *streamRefernece into Expression box (as shown in below image). click save and and click Exit Expression Builder

  •  Select Sample delimited document (e.g. CSV) to define the structure of the file contents. Then click Next

  • Define the structure of the file contents by selecting below Delimitated Sample File. After selecting file configure the other options as suggested below :
          Download Sample File

    • Enter  the record name : Student (you can give any meaning ful name)
    • Enter the Record set name : StudentsDetail (You can any meaningful name )
    • Select the Field Delimiter : Comma(,)
    • Optionally Enclosed by  : "
    • Terminated By : ${eol}
              Click Next 


  • Stage File Action configuration completed. Click Done.


Step 4 :Now lets add one Logger to log the received CSV data.


Knowledge :  👀 
Logger ? : It Enables you to add log messages to the activity stream and diagnostic logs.

  • Search for Logger action and add it in flow


 

  • Enter any meaningful name and then click Create 

  • Configure Logger option will get open , Select Log : Always and then click edit (pencil icon ) to map *Logger Message 

  • Drag and drop *StudentDetail tag from left hand side(Source side ) inside Epression box and then click validate and close

  • Click Validate and close 

Step 4 : Now enable the Tracking by clicking on right hand side hamburger sign and then click Tracking 


  • Drag and Drop *streamReference in Primary Tracking Field.You can select another also as per your requirement.
Click Save 

Knowledge :  👀 
Assigning Business Identifiers for Tracking Fields ? : Business identifiers enable you to track payload fields in messages during runtime.You must assign business identifiers before you can activate an integration.

  • Integration is ready to test. Save the integration and Activate it.




#Testing of Integration 

Now lets test the integration by passing some sample csv data as input of this integration and lets see the data are getting generated in Log or not.


 [ Note : -- If you want to test this integration by getting it trigger from any Source System (Like WMS System ). For that you can share the endpoint point url of this integration with WMS system and getting it configured in that system. After that that system can hit this integration by sending some CSV data. ]

  • Click on Run button
  • Click Test 
  • Pass the below sample CSV data and click Test
Name,Roll
Shyam,01
Rashmi,02
Raghu,03
Rajesh,04
Satya,05


  • You can see the input csv data in Log (as shown in below image)
  • If you want to see the CSV data in XML check the Read Response Payload.


Completed. This way we can configure REST Trigger Endpoint to receive CSV data from Source System(Like WMS)


November 28, 2020

How to configure Integration Properties in OIC

 

Integration Properties are user defined properties available for usage by activities (e.g Notification , Log) as read-only data with in the flow. Read only data 👉 because the integration property value can’t be updated within the integration. For example, you cannot update the integration property in an assign action.

You can update integration properties value outside of the regular integration design.At runtime, these integration properties take effect and override the values you configured at design time. 

For example, you can specify an email address to use in the To field of a notification action during runtime that overrides the email address specified at design-time. This feature enables you to configure the value without having to edit the integration design itself or having to pass the value at runtime.



*Note : You can configure all types of properties, including file path, database properties, server properties, credentials, and any constant property that changes at regular intervals.



Lets see the configuration steps with one example : 


Use Case - In this example we will see the steps to define, use and update integration property value. We will configure two integration properties having name "sendTo" and "sendFrom" that will store To and From email address for notification action.Further we will map these two properties with To and From field of a notification action.


  • Right click the trigger connection and select menu icon.Select Edit Integration Properties to add a property.
    • Click + to add Property Name and its Default Value. In this example I have added two parameter - 'SendTo' and 'SendFrom' to store notification email address.Enter their default values(email address) and click close.
                 Note : A maximum of 10 integration properties can be added.

    • Now open notification activity to map *From and *To  field with above declared property value "sendTo" and "sendFrom"
      • Drag and Drop *sendFrom inside From field expression box.
      • Similarly drag and drop *sendTo inside To field expression box.
    • Activate the integration.You have successfully configured and used integration properties.



Knowledge :

Scheduled integration support runtime runtime configuration. Therefore, you can update the integration property value when the integration is active. But App driven orchestration do not support runtime configuration.Therefore, you can update the integration property value when the integration is not not active. 




  • Now if you want to Update the integration property value
    •  Select  Actions menu.


    • Select Update Property Values.
    • Click the integration property to update, then enter a value in the New Value field and click Submit.In this example I have updated *sendTo value.
      • select *sendTo

      • Enter new email address inside New Value box and click submit.New Value replaces the currently stored value and will be used for the new run of the integration.

A confirmation message indicates that the property was updated successfully.

October 29, 2020

Global Variable and Data Stitch in OIC

In this article I have tried to explain the usage of Global Variable and Data Stitch Action.

 

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.




How Data Stitch and Global Variable can help ? 

Lets take one case scenario : 👉 
Suppose you 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 but you can perform many complex operation using Stitch Action.

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 :

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


Step 1 : Create one App Driven Integration.



Step 2 : Select Rest Trigger Connection(in my case it's 'REST_Conn') and configure it by providing basic detail along with Request and Response payload. 


  • Enter any meaningful name

  • Enter details as shown in below image and click Next


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


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

  • Click done.

Step 2 : Add one Scope 



Step 3 : 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 .
  • Download GV&DataStitch-EmployeeDetail.csv file and choose the same file. After selecting the file enter below details.
    • 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.





Declare Global Variable and Data Stitch : 


STEP 4 : 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]






 


STEP 5 :
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 4) 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 



STEP 6 :
Enable the Tracker



  • Click Save and Close the integration. 




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.

Thank You :)

close