Working With the SFTP Target Connector

This section discusses working with and setting node-level properties for the SFTP target connector.

The SFTP target connector enables the gateway to use SFTP to send messages to and receive messages from SFTP servers. It uses the PUT command to place messages or files from the integration gateway onto remote SFTP servers. The GET command is used to receive messages from SFTP servers.

Target Connector Processing

The SFTP Target connector does not directly connect to SFTP servers. The connector loops back into the application server and invokes a PeopleCode application class. This application class uses the GetAttachment and PutAttachment PeopleCode functions to make the connection to the target system. At runtime, the integration gateway logs show the details of the message transfer between the application server and the integration gateway, but does not show the details of the actual connection to the SFTP server.

Base64 Encoding

The SFTP target connector features a node - level property BASE64ENCODE to specify if Base64 encoding is required for PUT requests and present for GET requests.

The following table describes the impact of this property on PUT and GET requests.

Base64 Encoding

Description

Y (Default.)

Base64 encoding is required for PUT requests and is present on GET requests.

  • Put Requests.

    The message body is encoded before the system sends the request from the integration gateway to the application server. The application server then decodes the request before sending it to the SFTP server.

  • GET Requests.

    The application server Base64 - encodes the data before passing it to the integration gateway. The integration gateway then decodes the response message.

N

The gateway will not Base64–encode requests or Base64–decode responses. It is the responsibility of the developer to do both.

By default the property is set to Y.

Most users will have no need to modify this property. This property exists to allow binary data to be passed through the connector.

When you set this property to N, you can Base64 - encode binary data and pass that string to the connector for a PUT request. Since the property is N,, and the input string is already Base64 - encode, the integration gateway has no need to perform the encoding again. The input string is then sent to the application server, which Base64 – decodes all requests being sent to the SFTP server.

Conversely, in the case of a GET request, the application server Base64 - encodes all data pulled from the SFTP server. This encoded string is then passed to the integration gateway, which decides whether to decode or not based on the value of this property. If the property is set to N the string is not decoded, and the system allows it to pass through as-is. You can then take the Base64 string and process it as needed.

See the File Class Methods product documentation for information about the GetBase64StringFromBinary and WriteBase64StringToBinary methods.

Performance Considerations

The SFTP target connector allows SFTP functionality to be available in the integration gateway using the standard target connector pattern. However, because the SFTP target connector is effectively a wrapper around PeopleCode built-in functions, there is an associated impact on performance.

In certain scenarios this inefficiency may be deemed unacceptable; in those cases call the GetAttachment and PutAttachment functions directly and bypass the integration broker entirely.

Since the gateway calls back into the application server, at least two application server processes are involved in each SFTP invocation. Please ensure that the application server is configured with the appropriate number of processes. Failure to do so may result in SFTP requests being blocked when the gateway attempts to call back into the application server.

This section describes the required node-level properties you must set to use the SFTP target connector.

The following table describes the required node-level connector properties:

Property ID

Property Name

Description

SFTPTARGET

BASE64ENCODE

Specify if Base64 encoding is required for PUT requests or present GET requests. The values are:

  • Y. (Default.)

  • N.

See the SFTP Target Connector and Base64 Encoding section earlier in this topic for more information about this property and the property values.

SFTPTARGET

CHARSET

Specify the character set of the data on the SFTP server.

UTF-8 is the default value.

You can specify and use any of the standard character sets supported in the installed Java VM. Consult the Java docs for supported character sets.

For a PUT request the system converts the string to the character set specified before sending it to the SFTP server.

For a GET request the system converts the from the character set specified after it is read from the SFTP server.

This property has no effect on binary data transferred when the BASE64ENCODE property is set to N.

SFTPTARGET

METHOD

Specifies the type of SFTP request. Values are:

  • PUT. (Default.) Push the data to the SFTP server.

  • GET. Pull the data from the SFTP server.

SFTPTARGET

REMOTEFILENAME

Specify the file name to be used on the SFTP server.

For GET requests specify the name of the file to be retrieved from the SFTP server.

For PUT requests specify the file name to use when sending the data to the SFTP server.

SFTPTARGET

URL

Specify the location of the SFTP server.

The URL value references a URL object stored in the system. That URL object contains the actual address of the SFTP server, as well as any username and password required to access it.

See Understanding URL Strings Versus URL Objects in the Understanding the File Attachment Functions topic in the product documentation for more information..

SFTPTARGET

TEMPDIR

(Optional.) This property allows you to select the location on the application server where temporary files used during the file transfer process reside.

Unless you set this property to another location, temporary files are read and written to the PS_SERVDIR directory. Temporary files are automatically deleted after use.

If you set this property to a value other than PS_SERVDIR, the directory used is the concatenation of the value of the environment variable PS_SERVDIR and the value of the TEMPDIR property.

The value of the TEMPDIR property should include any necessary slash characters needed to form a correct directory path.

SFTPTARGET

ABSOLUTEPATH

(Optional.) This property is used in conjunction with the TEMPDIR property. The values are:

  • Y. The value of the TEMPDIR property is assumed to contain the value of a complete, absolute path to a location on the application server where temporary files can be written. The value PS_SERVDIR is ignored.

  • N. The value of the TEMPDIR property is assumed to contain a path pointing to a directory under PS_SERVDIR.

To specify optional properties you must add a row to the properties grid and manually enter the property ID, property name and value.