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


Appendix B FTP Script Examples : Third Tutorial Example

Third Tutorial Example
Two scripts are used for the third tutorial example:
The ssh_putexample.txt script, which puts the document to the SSHFTP server.
The ssh_mgetexample.txt script, which retrieves multiple files from the SSHFTP server. These files match a particular search filter, which in this example is the extension of the filename as well as the size of the file.
How ssh_putexample.txt Works
The ssh_putexample.txt script gets the SSHFTPClient object from the job variable that is created at runtime by BusinessConnect.
The SSHFTPClient object is used to connect to the SSHFTP server, both in proxy or non-proxy mode. It checks whether the examples1 directory is available and proceeds as follows:
If the examples1 directory is present, the script puts in the file created by the Initiator's outbound process.
If the examples1 directory is not present, it is created before the file is actually stored on the SSHFTP server.
If there are connection failures, a flag called retryScripts (with the constant name defined in the API com.tibco.ax.fw.runtime.transport.sshftp.SSHFTPClient.RETRY_SLOT) may be used to set the value as true, and passed on to BusinessConnect to retry the execution when retry of the outbound process occurs.
How ssh_mgetexample.txt Works
The ssh_mgetexample.txt script gets the SSHFTPClient object from the job variable that is created at runtime by BusinessConnect.
The SSHFTPClient object is used to connect to the SSHFTP server. It checks whether the examples1 directory is available. If it is, the script calls executeMgetCmd to get all the files from the SSHFTP Server.
Once the files are successfully retrieved, the files from the examples1 directory are deleted. If the files could not be retrieved for some reason (such as when a communication failure happens), the corresponding tracing and auditing entries are created. In such case, the script retrieves all files from the examples2 directory whose extension is *.bin and whose size is greater than or equal to 200 KB. Upon successful retrieval, the retrieved files are deleted.
Tutorial Files
The following files are part of this tutorial:
BC_HOME\samples\bc\sshftpscripts\ssh_putexample.txt
BC_HOME\samples\bc\sshftpscripts\ssh_mgetexample.txt
These are both EcmaScript files.
How to Send Files
For this example, send a document using BusinessWorks process as described in File Pollers.
Setting Up the Third Tutorial
Steps to Perform on the Initiator Computer
The following steps must be performed on the Initiator computer:
1.
2.
For the participant Seller, click the Transports tab for the EZComm protocol.
3.
Click Add.
4.
5.
Select SSHFTP in the Type list.
6.
7.
See TIBCO BusinessConnect Trading Partner Administration Guide, Configure SSHFTP Outbound for more information.
8.
Select Script in the File Processing list.
9.
Click change in the Scripts field.
10.
Select Uploaded File from the Type list.
11.
Click Browse to navigate to the BC_HOME\samples\bc\sshftpscripts directory.
12.
Click the ssh_putexample.txt file.
13.
Click Open.
14.
15.
Click Save.
16.
Click BusinessConnect > BusinessAgreements > Buyer-Seller.
17.
Click EZComm in the Agreement Protocol Binding list.
18.
Click the Transports tab.
19.
Select SSHFTP from the Primary Transport list in the Outbound Transports for the Host 'Buyer' area.
20.
Click Save twice.
Steps to Perform on the Responder Computer
The following steps must be performed on the Responder computer:
1.
2.
Click BusinessConnect > BusinessAgreements > Buyer-Seller.
3.
Click EZComm in the Agreement Protocol Binding list.
4.
Click the Transports tab.
5.
Click Edit SSHFTP Settings in the Allowed Inbound Transports for Partner 'Buyer' area.
6.
For more information, see the TIBCO BusinessConnect Trading Partner Administration Guide, Select and Configure SSHFTP Inbound.
7.
Select Script in the File Processing list.
8.
Click change in the Scripts field.
9.
Select Uploaded File from the Type list.
10.
Click Browse to navigate to the BC_HOME\samples\bc\sshftpscripts directory.
11.
Click the ssh_mgetexample.txt file.
12.
Click Open.
13.
14.
Select the Delete File check box.
15.
Click Save twice.
Running the Third Tutorial Example
To run the third tutorial example:
1.
2.
To configure BusinessConnect to poll a directory:
a.
b.
Specify Seller for the TpName directory. If your base directory is BaseDir, the directory path should be BaseDir/Seller.
c.
In TIBCO Administrator, click Application Management > BusinessConnect > Configuration.
d.
Click BusinessConnect.
e.
Click the Private Process Configuration tab.
f.
Click EZComm in the Outbound File Poller Configuration area.
g.
Select the Enable check box.
h.
Type BaseDir/Seller/*.* in the Directory to Monitor field.
i.
Click Save twice.
j.
Click Deploy.
k.
l.
3.
Copy the BC_HOME\protocols\ezcomm\samples\sampleXML\xsd\ WidgetAvailable.xml file into BaseDir/Seller.
Expected Results
After the Initiator BusinessConnect receives the file from the BusinessWorks process, or picks up the file from the outbound File poller directory, the following situations happen:
BusinessConnect then invokes the ssh_putexample.txt script. The script looks for the directory examples1 in the SSHFTP root directory, and creates it if it does not exist.
On the Responder computer, BusinessConnect runs the configured script that polls the specified directories.
When a file is detected, BusinessConnect retrieves this file through the script ssh_mgetexample.txt. This script looks for files in the examples1 and examples2 directories as described above.

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