To FTP

To FTP

With the To FTP workflow component you can FTP files to another machine.

 

With this you can tell the workflow to transfer any kind of payload (contents of the workflow).

 

If you e.g. previously created a PDF file, then you can use this component to transfer the PDF file in the file system.

 

The component accepts any payload as input.


Related workflow input type: Read from FTP.

 

Please notice the hints for the AS400/iSeries/IBM i platform below and the example of how this can be used.

 

The parameters are described below:

 

NG2WorkflowToFTP0001

 

 

Protocol

The type of transfer. These protocols are available:

FTP: File Transfer Protocol.

FTPS: FTP Secure.

SFTP: SSH File Transfer Protocol

SCP: Secure Copy Protocol


For secure connections InterFormNG2 will negotiate with the other machine to use the best encryption supported by both ends. InterFormNG2 currently supports these encryptions:

Ciphers: aes128-ctr, aes192-ctr, aes256-ctr, arcfour256, arcfour128, aes128-cbc, 3des-cbc, blowfish-cbc, aes192-cbc, aes256-cbc, aes128-gcm@openssh.com, aes256-gcm@openssh.com, chacha20-poly1305@openssh.com

Hostkey formats: ssh-rsa, ssh-dss, ssh-dss-cert-v01@openssh.com, ssh-rsa-cert-v01@openssh.com, rsa-sha2-256, rsa-sha2-256-cert-v01@openssh.com, rsa-sha2-512, rsa-sha2-512-cert-v01@openssh.com, ecdsa-sha2-nistp256, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, ssh-ed25519, ssh-ed25519-cert-v01@openssh.com, sk-ssh-ed25519@openssh.com

Key exchange protocols: ecdh-sha2-nistp521, ecdh-sha2-nistp384, ecdh-sha2-nistp256, diffie-hellman-group-exchange-sha256, diffie-hellman-group-exchange-sha1, diffie-hellman-group14-sha1, diffie-hellman-group1-sha1, diffie-hellman-group14-sha256, diffie-hellman-group15-sha512, diffie-hellman-group16-sha512, diffie-hellman-group17-sha512, diffie-hellman-group18-sha512, curve25519-sha256, curve25519-sha256@libssh.org, curve448-sha512, sntrup761x25519-sha512@openssh.com

Message authentication codes (MACs): hmac-md5, hmac-sha1, hmac-sha2-256, hmac-sha2-512, hmac-sha1-96, hmac-md5-96, hmac-sha1-etm@openssh.com, hmac-sha2-256-etm@openssh.com, hmac-sha2-512-etm@openssh.com

 

FTP Host

The remote machine, that you want to transfer to.

 

Port

The port number to use for the transfer.

These port numbers are usually used:

21 for FTP

21 or 990 for FTPS

22 for SFTP

22 for SCP

 

FTP Directory

The directory to transfer to on the remote machine.

 

Output file name

The file name to create on the remote machine.

 

File name conflict resolution

With this you specify what the workflow should do, if the file already exists. The options are:

Overwrite (default). If you select this, then any existing file with the same name will be overwritten by the new file.

Append version. Select this to add a counter (in parenthesis) at the end of the new file name - prior to the extension.

Rename existing. Rename the existing (old) file and add the timestamp to the file name. The old file will be rename similar to this: filename_20200812134611716.pdf.

Move existing. If you select this, then the original file will be moved to a subdirectory with the timestamp and the new file is created as requested.

 

Not only can you select one of the fixed values above for the file name conflict resolution, but you can also use an XPath expression to set a variable value e.g. depending on the input file. The XPath expression should return one of these values:

 

Overwrite

Rename

AppendVersion

AppendTimestamp

 

Unknown values will result in "Overwrite" being used.

 

The following values are also accepted (InterFormNG related values), BUT will result in a warning

append-version-number

rename-existing-file

overwrite-existing-file

 

FTP mode

Select between these modes:

Passive mode: Target server opens port and transfer port.

Active mode: Target server opens port and this server opens transfer port.

 

FTP User name (Optional)

The user ID for signing on to the remote server for the transfer.

 

FTP Password (Optional)

The password for signing on to the remote server.

 

 

Hints for FTP to an AS400/iSeries/IBM i machine

If you want to FTP from InterFormNG2 onto an AS400/iSeries/IBM i, then there are some suggestions below:

 

1.A prerequisite is, that the FTP server is running on the target machine. This can be started with the command, STRTCPSVR SERVER(*FTP), but it is very important to check with the system administrator first as FTP can be a potential security risk.

2.You can verify the current FTP settings on an AS400/iSeries by entering the command, CHGFTPA and then press F4 to display the current settings. You should NOT change the settings without confirming with your local system administrator! There are two settings, that are very important:

3.Initial name format, NAMEFMT. If this parameter is *LIB, then you can only FTP to the library.file system - not the IFS as the command, "quote site namefmt 1" is required before you can do an FTP to the IFS. If the parameter is *PATH, then you can FTP to the IFS.

4.Initial directory, CURDIR. This parameter can be either *CURLIB or *HOMEDIR. *CURLIB sets the current directory for the FTP to be the current library of the user profile, that is used for the FTP. *HOMEDIR sets the current directory of the FTP to be the home directory, that is specified on the user profile used for the FTP.

5.When you specify a target directory on the FTP transfer in InterFormNG2, then the path is the relative path for the home directory of the user on the target machine. That means, that if this user e.g. has a home directory called /home/myuser, then the specified directories are created inside this. If you want access to FTP to any target directory on the target machine, then you can change the home directory of this user profile. It is a potential security risk, if you extend this to be the complete IFS, but you can do that, if you change the user profile like so: CHGUSRPRF USRPRF(<user profile>) HOMEDIR('/').

 

Below two examples are included as to how you can implement the TO FTP component in a workflow:

 

1.Example for using the To FTP component.

2.Implement retry for the To FTP component.

 

 

Example for using the To FTP component

This is an example of how you can FTP a PDF file, that you have just created in an InterFormNG2 workflow.

 

You can do that by first creating the file, that you want to FTP e.g. with the component, Create PDF document and then send the new, merged payload with the To FTP component like below:

 

NG2ToPTF001

 

The first component in the workflow (after getting the input file) is the create PDF document element, which merges the input file (xml or spooled file) into a PDF file. This PDF file is not stored anywhere, but it is saved into the payload of the workflow.

 

This is how the create PDF document is setup here:

 

NG2ToFTP002

 

You can see, that it differs from the Create PDF file component in the way, that the PDF result (for create PDF document) is not stored into any file, but only kept in the payload, where the Create PDF file component keeps the original payload.

 

The next workflow component is the To FTP component as described above.

 

 

 

Implement retry for the To FTP component

It might be that the first FTP attempt does not work - if e.g. the target machine is temporary down or did not reply fast enough. In these situations you might want to retry the FTP a few times before giving up. As an aid you should consider the Retry-Repeat workflow component as below:

 

 

NG2ToFTP003

 

In the workflow above we have added this Retry-repeat component:

 

NG2ToFTP004

 

- prior to the To FTP component. With this setup the workflow will try the To FTP component up to 2 extra times if the initial FTP should fail. The workflow will wait 10 seconds between each retry.

 

If you want to report an error if all three attempts should fail, then you can consider to use an Error handler to call an error workflow. You just need to setup the error handler prior e.g. like below:

 

NG2ToFTP005

 

An alternative or addition is the general error report email option for the whole tenant.

    • Related Articles

    • Read from FTP

      This makes it possible for a workflow to connect to an FTP server and poll a folder on the remote file system. It works in a similar fashion to "read from file" except that the files are transferred over FTP. Also, since this requires a connection to ...
    • Basic output components

      The basic output workflow components are: 1.To filesystem 2.To FTP 3.To sub-workflow
    • File output

      InterFormNG2 can distribute all the output formats in many different ways. You can combine all input and output formats with all the distribution options. The list below shows all the ways you can distribute the output from InterFormNG2: 1.If you ...
    • Workflow input types

      The workflows of InterFormNG2 can get the input from various input types. In the workflow the input type is shown as the leftmost (green) component: The input types are all listed here: AS400 Command input Call InterFormNG2 via a command on the IBM i ...
    • Prerequisites

      •InterFormNG2 require Java Runtime Environment 17. This is embedded in the Windows release, but on the IBM i platform and on Linux you need to ensure that Java 17 is installed. •The minimum hardware configuration is: Dual core machine with 8 Gb RAM ...