Operation

This document describes how to operate the Transport Service software contained in the transport-upload package. The Transport Service software is a web application providing functionality for uploading files and writing them to a staging area. The following topics can be found in this section:

Interface

The Transport Service provides a REST-based interface accessible via HTTP for interacting with the service. The service only supports "multipart/form-data" HTTP POST requests which must include a "file" part containing the name of the file to be uploaded. Because of this limitation, HTTP GET requests are not supported. The service also accepts an optional "path" parameter for specifying a sub-directory. The following options are available for interacting with the Transport Service:

  • cURL

    The cURL utility offers the most flexible means for interacting with the application. The utility comes installed on most UNIX-based platforms and is available for download for the Windows platform. At this time, Wget does not support "multipart/form-data" form requests. The following is an example of using cURL to upload a file to the service:

    % curl -X POST -v -F file=@<fileSpec> http://localhost:8080/transport-upload/upload
              
  • HTML Form

    The web application includes an HTML Form test interface for uploading files to the service. The page is accessible at http://localhost:8080/transport-upload.

  • Upload Client

    This package also includes a Java implementation (gov.nasa.pds.transport.UploadClient) for interacting with the service along with a corresponding command-line script (transport-update) for execution. Examples for using this interface are detailed below.

The examples below use http://localhost:8080 as the default base end point for the service.

File Upload

The Transport Proxy web application provides functionality for retrieving directory listings and files from a Transport Service instance. The following table details the command-line options available:

Command-Line OptionDescription
<fileSpec>The file specification for the file to be uploaded to the service. This parameter is required.
<serverUrl>The URL for accessing the service. This parameter is optional and defaults to http://localhost:8080/transport-upload/upload.

The following is the command-line format for the transport-upload script:

% transport-upload <fileSpec> [<serverUrl>]
      

The following is an example of executing the transport-upload script to upload a file to the service (including expected output):

% transport-upload test.txt

Mar 13, 2016 7:43:12 PM gov.nasa.pds.transport.UploadClient main
INFO: Uploading file test.txt to server http://localhost:8080/transport-upload/upload.
Mar 13, 2016 7:43:12 PM gov.nasa.pds.transport.UploadClient upload
INFO: HTTP/1.1 200 OK
Mar 13, 2016 7:43:12 PM gov.nasa.pds.transport.UploadClient upload
INFO: File test.txt uploaded to /tmp.
      

If the URL of the Transport Service is not the default URL (http://localhost:8080/transport-upload/upload), it can be specified on the command-line following the file specification.