Connect With FTP And Read Files From FTP In OIC
Connect with FTP and read files from FTP in OIC
- What is FTP?
🡺 FTP stands for File Transfer Protocol.
FTP (File Transfer Protocol) is a network protocol for transmitting files between
computers over Transmission Control Protocol/Internet Protocol (TCP/IP) connections. Within the TCP/IP suite, FTP is considered an application layer protocol.
The end user’s computer is typically called the local host in an FTP transaction. The second computer involved in FTP is a remote host, which is usually a server. Both computers must be connected via a network and configured properly to transfer files via FTP. Servers must be set up to run FTP services, and the client must have FTP software installed to access these services.
Although many file transfers can be conducted using Hypertext Transfer Protocol (HTTP) — another TCP/IP suite protocol — FTP is still commonly used to transfer files behind the scenes for other applications, such as banking services. It is also sometimes used to download new applications via web browsers.
Before configuring the FTP connector, we need to install the FileZilla application in our system to access the directories.
Download link: https://filezilla-project.org/download.php?platform=win64
NOTE: That is not mandatory to install FileZilla in your system, if you have the right directory and file name then no need to install that.
Now go to the OIC Integration Platform to start reading the files from FTP
Step 1: Go to the Sign in page
Use Username and Password to log into the OIC Instance
Step 2: Click on the three lines to create a connection
Step 3: Click on the Design tab to create a connection
Step 4: Click on the Connections tab to create an FTP Connector
Step 5: Click on the Create button to configure an FTP Connector
Step 6: Search FTP in the search box and select the FTP Adapter
Step 7: Give a suitable name to the FTP Connector and click on the Create
NOTE: Identifier should populate automatically but we can change this and need to give any unique name. And the role should always be Invoke in the FTP adapter.
Step 8: Fill the required credentials and click on Test
Properties
- Host
- Port (21/22)
Security
- Security policy: FTP Server Access Policy
- User Name
- Password
Access type
- Public gateway
Step 9: Click on Diagnose & Test
NOTE: The difference between Test and Diagnose & Test is that Test will just test your connection it will not validate the credentials but Diagnose & Test will first validate your all credentials and it will test the connectivity with the actual FTP server.
Step 10: Click the Save button after the successful test
NOTE: If the Configuration progress bar reaches 100% then only you can ensure the successful connectivity with the FTP server.
Step 11: Click on the left arrow if that is showing Configured
NOTE: Identifier should populate automatically but we can change this and need to give any unique name. And the role should always be Invoke in the FTP adapter.
Connection is established, Now let us start the Integration
Step 12: Now Click on the Integrations tab and click on the Create button
Step 13: Click on the Schedule tab to create a scheduled integration
Step 14: In this create integration page give any suitable name and unique Identifier name and click on the create button
Step 15: After clicking the create button it will jump to the integration canvas
Step 16: Click on the plus icon & search for your FTP connector and select that
Step 17: In this Configure Basic Info page give a suitable action name (e.g., Read_File) that you want to perform and click Continue
Step 18: In this Configure Operations page, quickly select the required type of operation (in our case Read File), then select the Transfer Mode as ASCII, then give the Input Directory path, in the File Name field we need to give any specific file name and after that click Continue
Step 19: In this Configure Schema page, if we want to define the structure of the file then select Yes or select No, and click Continue
Step 20: In this Summary page check all the details, if wrong then click Go back and change the details, but if all are good then click Finish
Step 21: After clicking the finish button we will get an FTP connector to invoke type and a Map shape before that, in our case we already give the directory path and file name inside the connector so we don’t need that map shape before the FTP connector
Step 22: After that, we need to click three dots and select the Delete option
Step 23: After that click that plus icon and search logger and select a Logger shape
Step 24: After adding the logger shape open that shape, open the read file drop-down, find the size attribute inside the Properties drop-down, drag the size attribute because we want to log the file size coming from FTP, and paste it inside the Logger message text field and click on Save (We are not able to see the actual data because we are not given any structure to the response message, so we are not able to map the actual response data coming from the FTP file, we can see the meta-data about the file like filetype, directory, filename, lastModifiedTime, createdTime, size, checksum, etc)
Step 25: Now go to the Business Identifier (I) symbol and click that icon, it will display the Business Identifiers page and we need to drag the startTime attribute from the Sources, paste it inside the Business Identifier field, and click on Save
Step 26: Now we need to close that Integration to active that Integration, just click the left arrow to close the Integration
Step 27: After closing the integration we need to active that first to run, so for that we need to hover the integration first and click the Active button
Step 28: Now on the Activate integration page we need to select the Audit option and click on the Activate button
Step 29: After activating the integration quickly refresh the page and you can see your integration is in the Active stage, we need to click on the Action button (…)
Step 30: After clicking the Action button we need to click on the Run button to run our integration
Step 31: Now we need to select the Ad hoc request option and click on the Run button
Step 32: Now we need to click on the Instance ID link and it will display the complete flow of our integration
Step 33: Now click on the eye button and it will display the size of the particular file read from the FTP