Enter your keyword


How to write files using OIC FTP adapter

In this blog we are going to show you, how to use Oracle Integration cloud  FTP adapter to write files on the  SFTP location.

In my previous blog, I have explained how to create SFTP connection with the help of FTP adapter in Oracle Integration Cloud (OIC).

Use Case: In the blog, I’ll develop a REST service that will accept the below json in request, create a .csv file and upload the same on SFTP location.

“Designation”:”Sr. Manager”

This Use case requires only simple 4 steps to complete:

  1. Create REST connection
  2. Create FTP connection
  3. Create an Integration
  4. Activate the Integration
Let’s go step by step
  1. Create REST connection: The REST connection will be used to create the REST API. Refer the blog to create the REST connection.
  2. Create FTP connection: FTP connection allow you to interact with SFTP. We have already showcased the same in one of my blog. Please check it out before moving forward.
  3. Create an Integration: Follow below steps to create an App Driven Orchestration Integration
  • Login into OIC console and navigate to the Integrations -> Integrations
  • From the top right corner click on Create button
  • Select App Driven Orchestration pattern from the dialog box

Write file using FTP adapter in OIC

  • Enter Below information and click on Create 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 update it
    • Let the Version as it is
    • Enter the description in What does this integration do box
    • Leave the package box as it is
Write file using FTP adapter in OIC
  • Select inline or Drop the the REST connection on the canvas

Write file using FTP adapter in OIC

  • Enter “Write File” in the “What do you want to call your endpoint” input text and click Next button.
  • On the next screen, Enter below information and Click Next
    • What is the endpoint’s relative resource URI?: Enter /write
    • What action do you want to perform on the endpoint: Select POST
    • Select Configure a request payload for this endpoint checkbox- This option allows us to assign payload in the next step

Write file using FTP adapter in OIC

  • Select JSON Sample from the Select the request payload fromat drop down button.  Select inline link and enter the sample JSON payload as mentioned under Use Case section above
Write file using FTP adapter in OIC
  • Click Next and finish the wizard
  • Click Invokes from right, Select TEST_FTP_Conn, drag and drop the TEST_FTP_Conn just below the REST adapter

Write file using FTP adapter in OIC

  • Enter Name and optionally description. Click Next button

Write file using FTP adapter in OIC

  • 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 to be written
      • Specify a File Name Pattern: Either enter any hard coded file name or File Name pattern. In our case, I will enter a File name pattern as test_%yyMMddHHmmss%.csv
      • Append to Existing File: If this option is selected, the data will be appended to the existing file if already exist with same name.

Write file using FTP adapter in OIC

  • Select the below options and click on the Next button
    • Do you want to sepcify the structure for the contents of the file: Select Yes
    • Which one of the following choices would be used to describe the structure of the file contents: Select Sample delimeted document (e.g CSV)

Write file using FTP adapter in OIC

  • From the next screen, 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
    • The below table allows us to select which field to keep optional and which would be mandatory. Atleast one column must be mandatory.

Write file using FTP adapter in OIC

  • Review summary and finish the wizard
  • Click on Map to CreateFile mapper and click edit button
  • Mapper will allows us to map source and target fileds.
  • In order to create the headers in the csv file, expand Employee node from Target and click on Employees node and select “Repeat Node“. This action will add new Employees node in the target mapper.

Write file using FTP adapter in OIC

  • Expand the (1 of 2) Employees node
  • Right click on the EmployeeId and click on the Create Target Node. This action will open the Expression box on the bottom of the screen. Click Switch to Developer View icon

Write file using FTP adapter in OIC

  • Enter the hardocoded string as ‘EmployeeId‘ in single quotes and click on the Save icon.
  • Repeate above two steps for rest of the fields (FirstName, LastName, Qualification and Designation)
  • Now expand the (2 of 2) Employees node. Map the source and target fields as per below:

WriteFile/request-wrapper/employeeId —> CreateFile/Employee/(2 of 2) Employees/EmployeeId

WriteFile/request-wrapper/firstName —> CreateFile/Employee/(2 of 2) Employees/FirstName

WriteFile/request-wrapper/lastName —> CreateFile/Employee/(2 of 2) Employees/LastName

WriteFile/request-wrapper/Qualification —> CreateFile/Employee/(2 of 2) Employees/Qualification

WriteFile/request-wrapper/Designation —> CreateFile/Employee/(2 of 2) Employees/Designation

Write file using FTP adapter in OIC

  • Validate and Close the mapper
  • Select Actions icon from the top righ corner and click on Tracking. Integration can’t be activated without this step. Basically this allows us to track the message with configured parameter. In our case we will select employeeId field.

Write file using FTP adapter in OIC

  • 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 the integration is completed and this is the time to activate the integration.
4. Activate Integration
  • Click on Activate icon to activate the integration.

  • Select Enable tracking and Include payload check boxes. This option is useful if we want to see payload in the logs. Click Activate button

Write file using FTP adapter in OIC

  • This step will deploy the integration on the OIC server.
5. Test the REST service
Let’s try to test the integration now via the inbuilt testing tool in OIC. Hover the Integration, click on the Run icon and select Test 
  • Click on the Body and enter the JSON payload to test. Click on the Test button

  • Open FTP location and see the file should be created there.

You can view my YouTube video also.

Some Toughts (18)

  1. added on 24 Apr, 2018

    Helpful article i am new to ICS,this helps me lot…

  2. added on 3 Jun, 2018

    I relish, result in I discovered exactly what I used to be taking a look for. You've ended my four day lengthy hunt! God Bless you man. Have a great day. Bye
    open afp file

  3. Anonymous
    added on 4 Jun, 2018

    Hi, it's possible in your opinion to read the content of .txt file using FTP Adapter?Specila Thanks

  4. Anonymous
    added on 6 Jun, 2018

    Hi, do you have any sample integration from reading a file (FTP) until writing a file (FTP)? Basically, end-to-end process of reading and writing the same file. I had the same integration but even if I had an Append to an existing file option, only the last row is being printed. Thanks!

  5. added on 7 Nov, 2018

    The Portable Document Format (PDF) jam the designing of most records superior to anything options like HTML and MS Word. http://create-editable-pdf.com/

  6. added on 26 Jan, 2019

    The header is missing in the generated csv. How can I add that?

  7. Anonymous
    added on 6 Mar, 2019

    Hi my friend, one question, Why "Select a Transfer Mode: Select ASCII" and not Binary?

  8. added on 8 Mar, 2019

    Hi Ankur,

    I am totally stuck in one scenario wherein I am trying to create a target file using STAGE FILE Write Operation. The use case is I am downloading some sample file from FTP server and then using STAGE Read operation I am reading the file. After that I am trying to do some level of tranformation and create a new target file using STAGE WRITE operation.
    The issue that is happening is in my new target csv file all the rows are coming into single line only instead of coming to multiple lines.

    For e.g. if the input file contains data as mentioned below


    then the output that is getting generated is

    name1 name2 name3 100 200 300 test1 test2 test3

    Can you please provide any input on this.

    Highly appreciated !!

  9. added on 12 Mar, 2019

    Hi Sumit J,

    In the WriteFile mapper, right click on the repeated Employees element and click Add. After that hardcode the header values.


  10. added on 12 Mar, 2019


    I don't have as such. But you can refer my another blog to see how to read files using FTP adapter.



  11. added on 12 Mar, 2019

    Hi Ishan,

    Can you please share the IAR.


  12. added on 5 Jun, 2019

    There is one problem with that. When I try to right click and "repeat element", the new element is created in the end.
    Is there a way to move it as the first position so, I don't lose my mappings.

  13. added on 6 Jun, 2019

    Hi Carlos,

    Export the integration and change the xslt file directly. Move the element up and down as per your need.

  14. added on 21 Jun, 2019

    Hi Ankur,
    I am trying to move a file from source FTP location to Target. so when the source file name is "test.txt" i am trying to rename the target with "test_%yyMMddHHmmss%.txt". But the renaming doesn't happen . rather in the target i see, "test_%yyMMddHHmmss%.txt" as file name.

    Do let me know if i am making any pattern mistake.

  15. added on 24 Jun, 2019

    Try to delete double quotes from the file name.

  16. added on 13 Jul, 2019

    Thanks for sharing this great source of information. onlineconvertfree

  17. added on 18 Jul, 2019

    Thankyou for sharingerp software

  18. added on 19 Jul, 2019

    This comment has been removed by the author.

Leave a Reply

Your email address will not be published.