Configuring a Secure FTP Read Service

How to:

Reference:

The Secure FTP (SFTP) Read service is used to read a file using SFTP and return the read result.

To configure a SFTP Read service:

  1. Perform the steps as described in Configuring Services.
  2. Ensure that you select SFTP Read Agent {com.ibi.agents.XDSFTPReadAgent} as the service type you are configuring.

    For a complete description of the configuration parameters that are available for the SFTP Read service, see SFTP Read Service Parameters.

    For a complete description of the edges that are returned by the SFTP Read service, see SFTP Read Service Edges.


Top of page

x
Reference: SFTP Read Service Parameters

The following table lists and describes parameters for the SFTP Read service.

Property Name

Property Description

File Name

The special register namespace in which protocol headers from the incoming request will be saved.

File Name not a Document Tag

The special register namespace from which protocol headers for the outbound response will be taken.

Enclose Tag

The name of the tag that encloses the data read. If omitted, no entagging is used. If used, the output is XML.

Base Path

The optional directory to be used if incoming name is not absolute.

Input Data Format

The format of the input data, default is flat.

Transfer Type

For non-XML, this parameter sets the transfer type.

Host Name

The name of the SFTP server to connect to.

Remote Port

The port to connect to on the SFTP site. If left blank, the default is port 22.

User Name

The username on the SFTP server through which files are emitted.

Password

The password for the user account to use when connecting to protocol host.

Private Key

The SSH Private Key file used for server authentication (required is password is omitted).

Pass Phrase

The SSH Passphrase used when Private Key was generated (optional).

Encoding

The character set encoding to be performed on the input.

Delete After Read

The flag to show whether to delete the file after the read.



x
Reference: SFTP Read Service Edges

The following table lists and describes the edges that are returned by the SFTP Read service.

Edge

Description

success

Operation completed successfully.

fail_parse

Failed to properly parse the input parameters of the service.

fail_connect

Failed to connect to SFTP host for any one of the following reasons:

  • The host name (IP) is invalid.
  • The User ID is invalid.
  • The password of the user is invalid.
  • The connection failed.

fail_operation

Invalid parms or other error.

fail_notfound

The file name in the File Name Tag parameter does not exist on the SFTP host.

fail_delete

Failed to delete the file either after the initial read, or when the transaction successfully completed.



x
Procedure: How to Test a SFTP Read Service Using a Private Key File

The SFTP Read service is used to read files from a SFTP server (drive on UNIX or Windows). It can also be used in tandem with a file listener to embed file contents (the file picked up by the listener) into the xml file read from the SFTP drive by specifying the tag.

  1. Construct a process flow called sftp, which consists of a Service object (for example, sftpservice) that refers to the XDSFTPReadAgent class, as shown in the following image.

  2. Construct the process flow as shown in the following image.

  3. Add the sftp process to a route (for example, myRoute). Construct a channel (for example, File1) consisting of a file inlet, myRoute, and a default outlet.
  4. Build and deploy the channel.
  5. Start the channel.
  6. Copy an XML file (for example, test.xml) to the directory where the File1 listener is listening. This XML file can have the following content:
    <test>c:\test\a.txt</test>
  7. Let the a.txt file consist of the following text:
    This is a sftp readagent test
  8. The File1 channel processes the XML file (test.xml), reading the file a.txt and generates the file testout.xml, which is copied to the destination directory specified for the file listener. The file testout.xml has the following content:
    <testout> This is a sftp readagent test </testout>

iWay Software