SFTP Put and SFTP Get Activities Sample

This sample service invokes the SFTP put and get commands. The service reads a file and places it on the specified SFTP server. After a short wait, the SFTP get command is issued and the file contents are written back to local storage.

Prerequisites

Copy the sftp-file.txt file included in this sample to the D:\tmp directory. If the directory is not available, refer to the steps listed in the Understanding the Configuration section. Ensure that the following SFTP server information is available:
  • SFTP server name or IP address
  • SFTP server port (default is 22)
  • SFTP Username
  • SFTP user Password

Procedure

  1. In the samples directory, select palette > sftp > PutAndGet and double-click tibco.bw.sample.palette.sftp.PutAndGet. For more information, refer to Accessing Samples.
  2. In the Project Explorer expand the tibco.bw.sample.palette.sftp.PutAndGet project.
  3. Set the default ApplicationProfile to match the OS you are running on. For more information, refer to Setting the Default Application Profile.
  4. Copy the sftp-file.txt file to D:\tmp.
  5. Fully expand the Resources directory and then double-click SFTPConnectionResource.sftpResource. Specify valid values for your SFTP connection in the Host, Port, User Name, and Password fields. Click Test Connection to verify your SFTP connection.

Result

  • The file specified by the module property SFTP-PutFile is copied to the SFTP server.
  • The file specified by the module property SFTP-GetFile is written to D:\tmp by the SFTP server. The default name is sftp-file-2.txt.

Understanding the Configuration

The sample project has default values for the file names. You can change the defaults, if needed for your environment.

  1. Under Module Descriptors, click the configuration file.
  2. Modify SFTP-PutFile to point to the input file.
  3. Modify SFTP-GetFile to point to the output file that will be written to on disk.