Perform the following steps after creating the FTP connection to transfer files to the FTP server using Canvas Studio:
- Right-click the created FTP server connection and select Create Data Source.
Refer Connectors - FTP for more information on creating a FTP connection.
The Create Request page appears. - Enter a unique data source name in the Data Source Name field.
Select Put File option in Request Type to send requested file to the FTP server.
Refer Receiving Files from FTP Server for more information on receiving files from the FTP server.
Provide the appropriate file path on the FTP server to which the files need to be transferred to the server in Relative Path on Server field.
Provide the appropriate local file path from which the files need to be transferred from your local in Local File Path field.
Provide the file name that needs to be sent in File Name field.
You can receive files of following formats from the FTP server:
- CSV
- XLS
- XLSX
- Click Save.
A success message for creating the datasource appears as shown in the following screenshot: Click Ok.
In order to trigger the FTP service connection, the CT platform's server-side API, CT.ftp must be used while passing the ExecutionContext action in a Java Handler class. Refer the following sample code snippet for better understanding on the triggering process:
Here, on the following sample code snippet a new ExecutionContext action is created within which a map (HashMap) is built. The FTP datasource ID is passed as the input to activate the connection request within which the CT.ftp API is passed to trigger the process.
ExecutionContext ec = new ExecutionContext(); Map inputParams1 = new HashMap(); inputParams1.put("DATA_SRC_ID","FTP_DS"); // FTP_DS refers to the Datasource ID. ec.setInitialRequestData(inputParams1); try { CT.ftp(ec); } catch(Exception e){ }
Add Comment