Configuring a SFTP File Ops Service

How to:

Reference:

The SFTP File Ops (Operations) service is used to perform simple SFTP file operations.

To configure a SFTP File Operations service:

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

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

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

Reference: SFTP File Ops Service Parameters

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

Parameter

Description

Host Parameters

Host Name (required)

DNS name (or IP address) of the SFTP server to which you want to connect. Use host:port format if the standard port is not 22.

Remote Port (required)

Port to connect to on the SFTP site. Leave blank for default port 22.

Buffer Size

Size of the SFTP buffer to be used when sending or retrieving data. The default value of 32768 is used if this parameter value is not specified. A larger buffer may improve performance but setting this field to a value greater than 65536 will default to 65536. The value must be entered as a whole number (for example, 32768, 65536). iWay recommends leaving the buffer size at 32768.

SSH Parameters

User Name

Is the valid user ID on the SFTP server.

Password

Is the valid password for the SFTP server (optional and not used if Private Key is configured).

Private Key

Path to the private key file for public-key authentication.

Passphrase

Passphrase used to protect the Private Key (optional and required only if Private Key is passphrase protected).

Provider

Name of the SSH Client Security Provider to use. If no Provider name is specified, then enter the User Name and either a Password or a Private Key and Passphrase values. Passphrase is required only if the Private Key file is passphrase protected.

Agent Parameters

Operation (required)

Operation to perform on the file hosted by the SFTP Server. Operations supported by this service are as follows:

  • copy. Copies the data from the file addressed by the File (from) parameter to the file named in the File (to) parameter.
  • move. Moves the data from the file addressed by the File (from) parameter to the file named in the File (to) parameter. When successfully completed the file addressed by the File (from) parameter is deleted.
  • rename. Renames the file addressed by the File (from) parameter to the file named in the File (to) parameter. When successfully completed the file addressed by the File (from) no longer exists.
  • prepend. Copies the data from the file addressed by the File (from) parameter to the beginning of the file named in the File (to) parameter.

Operation (continued)

  • append. Copies the data from the file addressed by the File (from) parameter to the end of the file named in the File (to) parameter.
  • delete. Deletes the file addressed by the File (from) parameter from the host.
  • size. Gets the size of the file addressed by the File (from) parameter from the host. The return is places in the Special Register named in the Remote Size parameter.
  • exist. Verifies that the file addressed by the File (from) parameter exists on the host.

File (from) (required)

Name of the source file. This field may be a relative or absolute file paths, a SREG or XPath expression. This is a required field.

File (to) (required)

The name of the destination file. Wild cards are accepted. This is a required field except when operation is delete, size, or exist.

File (to) a directory name

References a directory. For more information on this parameter, see the description and example that follows this table.

File (to) Create Directories

Creates a directory if one does not exist. For more information on this parameter, see the description and example that follows this table.

Remote Size

Name of the Special Register designated to hold size. This field is required when operation is size.

Out Document (required)

Specify the document to be returned by the operation (bad input defaults to result).

Selecting result returns the results of the requested operation. In the case of copy, move, rename, delete, size, and exist, the status document containing the status of the function is returned.

The functions prepend and append result in the file data being returned. This data will be the same as the data found in the file addressed by the File (to) parameter.

Action on Failure (required)

Determines whether the input document or status document is returned on failure.

Retry (required)

If non-zero, the operation will be retried n times at one-second intervals.

File (to) a directory name Parameter

The File (to) a directory name parameter references a directory.

The default value for this parameter is false and iSM will use the path specified in the File (to) parameter to reference a file path. If the File (to) a directory name parameter is set to true, then iSM will use the File (to) parameter to reference a directory path and the file created will have the same file name as the File (from) parameter.

Example:

The File (from) parameter has the file name temp/output.xml, the File (to) parameter has the name prod/final, and the File (to) a directory name parameter is set to true. The results can be found in the file output.xml in the directory prod/final. Otherwise, if the File (to) a directory name parameter is set to false (default), the results will be found in the file final in the directory prod.

Note: iSM supports the creation of dynamic File (to) file names using special iSM file name patterns using a combination of the following three characters (#*^). These characters are only allowed when the File (to) parameter is a file name (File (to) a directory name parameter is set to false). If the File (to) a directory name parameter is set to true and the parameter contains one of the iSM pattern characters (#*^), an error occurs.

Additionally, iSM’s pattern control file is saved in the file directory:

[iwayworkdir]/sftpdata/File (to) parent directory

For example, if using the FTP Ops service and the File (to) parameter is set to prod/ism####.xml, then the pattern control file would be located as follows:

[iwayworkdir]/sftpdata/prod/.ism####.xml

File (to) Create Directories Parameter

The File (to) Create Directories parameter creates a directory if one does not exist.

iSM now supports dynamic creation of the directory tree. The default value for the File (to) Create Directories parameter is false. If set to false, the directory structure is expected to already be in place, and if not, an error is returned. If set to true however, iSM will attempt to create the directory structure defined by the File (to) parameter. If successful, the full tree structure as defined in the File (to) parameter will be created before the function is performed.

Example:

The File (to) parameter is set to prod/final/f0001.xml. iSM checks for the existence of the directory prod. If prod does not exist, then prod is created. Next the directory final is checked. If final does not exist, then final is created and so on until the directory structure is complete. Once the directory structure is in place the service executes the configured function.

Note: If an attempt to create the tree structure fails (due to an error being returned from the remote system), some part of the tree structure may have been created. It is the responsibility of the user to determine the correct course of action to stabilize the directory structure of the remote system.

Reference: SFTP File Ops Service Edges

The following table lists and describes the edges that are returned by the SFTP File Ops 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.

Procedure: How to Test the SFTP Ops Service for a Copy Operation

  1. Create a process flow and add a service object for the SFTP File Operations service (com.ibi.agents.XDSFTPOpsAgent), as shown in the following image.
  2. Set the Service object class name to com.ibi.agents.XDSFTPOpsAgent.
  3. Set the properties as shown in the following image.

    The From file test.txt is:

    This is an SFTPServer test

    The to file out6.txt is:

    <parent><test1>Soumya</test1></parent>
  4. Test run the process flow SFTPOps.

    The to file out6.txt content is modified as:

    This is an SFTPServer test

Procedure: How to Test the SFTP Ops Service for a Move Operation

  1. Create a process flow and add a service object for the SFTP File Operations service (com.ibi.agents.XDSFTPOpsAgent), as shown in the following image.
  2. Set the Service object class name to com.ibi.agents.XDSFTPOpsAgent.

    Set the properties as shown in the following image.

  3. Test run the process flow SFTPOps.

    The ‘From’ File test.txt is renamed to the ‘To’ file name i.e. testmove.txt.

Procedure: How to Test the SFTP Ops Service for a Prepend Operation

  1. Create a process flow and add a service object for the SFTP File Operations service (com.ibi.agents.XDSFTPOpsAgent), as shown in the following image.
  2. Set the Service object class name to com.ibi.agents.XDSFTPOpsAgent.

    Set the properties as shown in the following image.

    The From file /users/edasxr/testdir/out6.txt is:

    this is a test

    The to file /users/edasxr/testdir/testmove.txt is:

    for sftpops agent
  3. Test run the process flow SFTPOps.

    The to file testmove.txt content is modified as:

    this is a test for sftpops agent

Procedure: How to Test the SFTP Ops Service for an Append Operation

  1. Create a process flow and add a service object for the SFTP File Operations service (com.ibi.agents.XDSFTPOpsAgent), as shown in the following image.
  2. Set the Service object class name to com.ibi.agents.XDSFTPOpsAgent.

    Set the properties as shown in the following image.

    The From file /users/edasxr/testdir/out6.txt is:

    this is a test

    The to file /users/edasxr/testdir/testmove.txt is:

    for sftpops agent
  3. Test run the process flow SFTPOps.

    The to file testmove.txt content is modified as:

    this is a test for sftpops agent

Procedure: How to Test the SFTP Ops Service for a Delete Operation

  1. Create a process flow and add a service object for the SFTP File Operations service (com.ibi.agents.XDSFTPOpsAgent), as shown in the following image.
  2. Set the Service object class name to com.ibi.agents.XDSFTPOpsAgent.

    Set the properties as shown in the following image.

  3. Test run the process flow SFTPOps.

    The From file /users/edasxr/testdir/out6.txt is deleted.

Procedure: How to Test the SFTP Ops Service for a Rename Operation

  1. Create a process flow and add a service object for the SFTP File Operations service (com.ibi.agents.XDSFTPOpsAgent), as shown in the following image.
  2. Set the Service object class name to com.ibi.agents.XDSFTPOpsAgent.

    Set the properties as shown in the following image.

  3. Test run the process flow SFTPOps.

    The 'From' File test.txt is renamed to the 'To' file name i.e. testmove.txt.

Procedure: How to Test the SFTP Ops Service for a Size Operation

  1. Create a process flow and add a service object for the SFTP File Operations service (com.ibi.agents.XDSFTPOpsAgent), as shown in the following image.
  2. Set the Service object class name to com.ibi.agents.XDSFTPOpsAgent.

    Set the properties as shown in the following image.

Procedure: How to Test the SFTP Ops Service for an Exist Operation

  1. Create a process flow and add a service object for the SFTP File Operations service (com.ibi.agents.XDSFTPOpsAgent), as shown in the following image.
  2. Set the Service object class name to com.ibi.agents.XDSFTPOpsAgent.

    Set the properties as shown in the following image.