In this blog we are going to show you, how to use Oracle Integration cloud service FTP adapter to write file on any FTP location.
In my previous blog, we have explained how to configure FTP adapter in Oracle Integration Cloud Service.
After this blog, we have learned how to use FTP adapter to write files on FTP location.
Use Case: Develop REST service that exposes the below json, create a .csv file and post the same on FTP location.
{
"employeeId":"ABC@123",
"firstName":"Ankur",
"lastName":"Jain",
"Qualification":"MCA",
"Designation":"Sr. Manager"
}
"employeeId":"ABC@123",
"firstName":"Ankur",
"lastName":"Jain",
"Qualification":"MCA",
"Designation":"Sr. Manager"
}
This Use case requires only simple 4 steps to complete:
- Create REST connection
- Create FTP connection
- Create an Integration
- Activate the Integration
Let's go step by step
- Create REST connection: The REST connection we are gonna to create will work as a Trigger point. We have already showcased the same in one of my blog. Please check it out before moving forward.
- Create FTP connection: FTP connection will work as a Target point. We have already showcased the same in one of my blog. Please check it out before moving forward.
- Create an Integration: Follow below steps to create an Integration
- Login into ICS console
- Click on the Integration tile from ICS home page
- Click on Create button from upper right corner
- Select Orchestration pattern from the dialog box
- Enter Below information and click on Create button
- Select Application event or business object radio button
- Enter Integration Name in What do you want to call your integration text box
- An Identifier would be picked up automatically from Integration name however you can edit it
- Let the Version as it is
- Enter the description in What does this integration do box
- Leave the package box as it is
- Integration pane will look like
- Drag the TEST_REST_Conn Connection on the canvas from REST connection
- Enter below information and Click Next
- Name of the end point
- Relative URI(must start with /)
- Select HTTP verb
- Select Configure a request payload for this endpoint checkbox- This option allows us to assign payload in the next step
- Select Json Sample Radio button: This option allows us to take input in json format. Select inline link to give sample payload
- Enter payload and click OK
- Click Next and Done button
- Click Invokes from right navigation, Select TEST_FTP_Conn, drag and drop the TEST_FTP_Conn below PostEmployee
- Enter Name and optionally description. Click Next button
- Enter below information and click Next button
- Select Operation: In our case select Write File
- Select a Transfer Mode: Select ASCII
- Specify an Output Directory: Enter directory location where the file would be written
- Specify a File Name Pattern: Either enter any hard coded file name or File Name pattern can be entered. In our case we have entered a File pattern test_%yyMMddHHmmss%.csv. So the file would be created in this format only
- Append to Existing File: If this is check, data will be appended to the existing file if already exist with same name
- Select the option as shown in below screen shot and click Next button
- Enter below information and Click Next button
- Select the Delimited Data File: Select the comma separated file from your local machine. Please download sample file from here
- Enter the Record Name: Enter Employees
- Enter the Recordset Name: Enter Employee
- Select the Field Delimiter: Select Comma(,) as a delimiter
- Character Set: This allows us to select character set
- Optionally Enclosed By: Let it be "
- This table allows us, to select which field would be optional and which would be mandatory
- Review summary and click Done button
- Click on Map to Write File mapper and click edit button
- Select Action icon and click on Tracking. This is mandatory step and can’t activate integration without this step. Basically this allows us to track the Instance with configured parameter. In our case we will select employeeId field.
- Drag & Drop the employeeId from left panel to first row in Tracking Field and click Done button
- Click Save and Close button from upper right corner
Now our integration is completed and now turn to activate the integration.
4. Activate Integration
- Click on Activate button
- Select Enable tracking and Include payload check boxes button. This option is useful if we want to see payload in the logs. Click Activate button
- As soon as, integration will be activated, ICS will show you the service end point on the upper side as shown in the below screen shot. Alternatively, you can click on the info icon near to the activate button that will show you the service end point.
This completes our integration now. and this is the time to test the service and see the file should be created at mention location. We will use POSTMAN tool to test the REST service
5. Test the REST service
Tidak ada komentar:
Posting Komentar