Performing File Transfers Using HTTP Protocol

Here is the procedure to perform an HTTP upload or download. This procedure should work in any programming language that has HTTP client classes.

These steps are the same steps that the MFT Browser client uses. So you can use the browser client to test these steps. We suggest that initial tests use HTTP so you do not have to worry about any certificates. When using HTTPS, you may need to add the MFT server certificate to the Java cacerts file. Optionally, you may be able to create a certificate manager to handle certificate exceptions.

Prerequisites

TIBCO MFT Internet Server requires a NONCE for each jsondirtree request. The NONCE must be added to each request in the format: org.apache.catalina.filters.CSRF_NONCE=085980EE44051B48CE865FF3999765F8. We suggest that all code meant for upward compatibility support the NONCE. When running on versions prior to TIBCO MFT Internet Server 8.1, the NONCE is not returned and the NONCE URL parameter is ignored.

Procedure

  1. Authenticate to MFT Server.
    1. Set the basic authentication header, and send request to: https://your.host:port/cfcc/login/servlet/login. For example: https://10.1.2.3:443/cfcc/login/servlet/login
      The following HTTP codes indicate success: 200 302
    2. Extract and save the JSESSIONID in the JSESSIONID cookie.
      Note: The JSESSIONID cookie must be included in all requests documented below.
  2. Get the MFT FTServiceSessionID cookie.
    1. Using the JSESSIONID cookie in the HTTP session, go to: https://your.host:port/cfcc/control?view=view/filetransfer/browser/start.jsp. For example: https://10.1.2.3.4:443/cfcc/control?view=view/filetransfer/browser/start.jsp
      The following HTTP codes indicate success: 200 302
    2. Extract and save the FTServiceSessionID in the FTServiceSessionID cookie.
      Note: The value of the cookie must be included in the SessionID parameter of the upload and download URL defined in Step 4.
  3. Get the File ID and virtual alias of the file to be uploaded or downloaded.
    The jsondirtree.jsp call has the following purposes:
    • Extract the BToken used in the upload and download request.
    • Extract the NONCE used by subsequent jsondirtree requests for TIBCO MFT Internet Server 8.1 and later.
    • Navigate through the directory structure of a remote transfer definition.
    1. Issue a call to return the session token and the NONCE: https://your.host:port/cfcc/control?view=view/filetransfer/jsondirtree.jsp. (Do not include any URL parameters on this request.)
      This request returns two important fields in the JSON Response:
      • csrftoken: &org.apache.catalina.filters.CSRF_NONCE=B805F69A7A796585C5B64094C5AA5412
      • token: -470748818111506828
    The "token" must be passed to the upload and download URL links defined in Step 4 using the URL parameter BToken. If a NONCE is returned, it must be included in each subsequent call to jsondirtree by appending the value to the URL. For example: https://10.1.2.3:443/cfcc/control?view=view/filetransfer/jsondirtree.jsp&action=gettree&path=/&org.apache.catalina.filters.CSRF_NONCE=085980EE44051B48CE865FF3999765F8. You can hard-code the FileID, or you can navigate through the directory structure to return the FileID for a particular virtual alias.
    Note: Versions of TIBCO MFT Internet Server prior to 8.1 do not return a NONCE.
  4. Perform the file transfer.
    1. Decide whether the transfer is an upload or download. Call the proper Java or Python HTTP classes to perform an HTTP upload or download and pass this class to one of the URL as shown here.
    • Download URL:

      https://your.host:port/cfcc/control?view=servlet/fileTransfer&FileID=transferId&BrowserXfer=Y&BToken=token&AliasInPath=Y&ClientFileName=clientfilename&SessionID=MFTSessionId&ServerFileName=/serveralias/filename

      For example:

      https://10.1.2.3:443/cfcc/control?view=servlet/fileTransfer&FileID=FA0550000001&BrowserXfer=Y&BToken=8707202069055907714&AliasInPath=Y&ClientFileName=c:\temp\test.file&SessionID=a0401bcfa9264a68e0c5cda1ead7a0587f9d37c9&ServerFileName=/local/test.file

      Note: You must fill in the following fields:
      • FileID: from Step 3: jsondirtree call
      • ClientFileName: Is the fully qualified file name where the file is to be saved
      • BToken: from Step 3: jsondirtree call
      • SessionID: from Step 2. This is the FTServiceSessionID.
      • ServerFileName: Include the Virtual Alias and the file name to be downloaded. If the file is in a subdirectory, you must include the filly qualified path name. The download request can use method GET or POST. ( An upload request has to be with method POST and the http header "Content-Type" has to be multipart/form-data

        Content-Type:

        multipart/form-data;

    • Upload URL:

      https://your.host:port/cfcc/control?view=servlet/fileTransfer&AliasInPath=Y&FileID=transferId&BToken=token&BrowserXfer=Y&ClientFileName=clientfilename&SessionID=MFTSessionId&ServerFileName=/serveralias/

      For example:

      https://10.1.2.3:443/cfcc/control?view=servlet/fileTransfer&AliasInPath=Y&FileID=FA0550000002&BToken=8707202069055907714&BrowserXfer=Y&ClientFileName=mywordfile.docx&SessionID=a0401bcfa9264a68e0c5cda1ead7a0587f9d37c9&ServerFileName=/local/

      Note: You must fill in the following fields:
      • FileID: from Step 3: jsondirtree call
      • ClientFileName: Is the fully qualified file name where the file is to be saved
      • BToken: from Step 3: jsondirtree call
      • SessionID: from Step 2. This is the FTServiceSessionID.
      • ServerFileName: Include the Virtual Alias and the file name to be downloaded. If the file is in a subdirectory, you must include the filly qualified path name. The upload request has to be with method POST and the http header "Content-Type" has to be multipart/form-data

        Content-Type:

        multipart/form-data;

Result

The following HTTP codes indicate success: 200
Note: The response body is a JSON object string.