Sunday, 30 July 2017

How to write files using ICS FTP adapter

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.

"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 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.
  2. 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.
  3. 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
  • Map the source and target field as shown in the below scree shot. Click Validate and Close 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
  • Open postman tool
  • Enter service end point
  • We have to add Basic Auth as ICS service is automatically secured. We need to provide ICS console credentials.

  • Enter payload and hit Submit button
  • Open FTP location and found one file should be created there

That's done !


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

  2. 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. Hi, it's possible in your opinion to read the content of .txt file using FTP Adapter?Specila Thanks

  4. 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!

    1. Hi,

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


  5. The Portable Document Format (PDF) jam the designing of most records superior to anything options like HTML and MS Word.

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

    1. Hi Sumit J,

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


    2. 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.

    3. Hi Carlos,

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

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

  8. 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 !!

    1. Hi Ishan,

      Can you please share the IAR.


  9. 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.

    1. Try to delete double quotes from the file name.

  10. Thanks for sharing this great source of information. onlineconvertfree

  11. This comment has been removed by the author.