Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Appendix B FTP Script Examples : Fourth Tutorial Example

Fourth Tutorial Example
The putencrypted.txt script uses PGP API to process messages, and then puts them on the FTP server.
The getdecrypted.txt script receives files and then processes them using the PGP API. These files match a particular search filter, which in this example is the trading host name.
How putencrypted.txt Works
This script gets the FTPClient object from the job variable that is created at runtime by BusinessConnect. The FTPClient object is used to connect to the FTP server. (This works only in non-proxy mode.) It checks if the BCFTP/in directory is available. If it is, it puts the file created by the Initiator's outbound process and processed by PGP API. If the BCFTP/in directory is not present, that directory is created before the file is actually stored in the FTP server.
If there are connection failures, a flag called retryScripts is set to true and passed on to TIBCO BusinessConnect to retry the execution when retry of the outbound process occurs.
How getdecrypted.txt Works
This script gets the FTPClient object from the job variable that is created at runtime by TIBCO BusinessConnect. FTPClient object is used to connect to the FTP server. It checks if the testBC/out/BC directory is available. If it is, the script calls executeMgetCmd to get all the files from the FTP Server.
Once the files are successfully retrieved and then processed by PGP API, the files from the testBC/out/BC directory is deleted. If the files could not be retrieved for some reason, for example, if a put is happening at the same time and the file descriptor is being locked by another process, then the files from the testBC/out/BC directory is not removed.
Tutorial Files
The following files are part of this tutorial:
BC_HOME\samples\bc\ftp_bcpg\putencrypted.txt
BC_HOME\samples\bc\ftp_bcpg\getdecrypted.txt
How to Send Files
To send a document using BusinessWorks process, see File Pollers.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved