8.18.32016-03-14

HTTP Server Workflow

An HTTP Server workflow is one that has one or more processes that always start with the HTTP Server Input task and returns something to a client using a web browser. Each process would have a specific task referred to as an "action", called from the browser itself.

HTTP Server input tasks are typically used in one of the two following situations:

PReS™ Workflow can serve both static and dynamic resources to a web browser, however it is not meant to be used as a fully featured web server, as it is not built for responsiveness nor guaranteed uptime. It is much better to have a common web server (for example, IIS or Apache) to serve your contents and to have PlanetPress available only to process things only it can do.

You can control access to the PlanetPress Suite Workflow Tools HTTP Server via the Access Manager.

Important Configuration, Setup and Options

Before starting to work with HTTP workflows, there are few key points to keep in mind in terms of configuration. First of all, the following options are available in PReS™ Workflow Preference screen, under the HTTP Server Input 1 and HTTP Server Input 2 sections:

As of PReS™ Workflow 8.1, it is now possible to serve a default HTML file when no action is specified, for example http://localhost:8080/ . This is done by creating an index.html file in the Resource Folder defined above. However, resources called by this index.html must still use the Resource action name, for example a stylesheet would still point to http://127.0.0.1:8080/static/css/style.css or more simply static/css/style.css.

You also need to take into consideration the options inside each of your processes that start with the HTTP Server Input task, as they will greatly impact how this process responds. In the process' properties, the following options will modify HTTP behavior:

And finally, the HTTP Server Input task properties. While these are described in the HTTP Server Input task properties page, here are a few considerations to keep in mind when using this task:

Request/Process/Response cycle

Once a process using the HTTP Server Input task is created, it is important to understand the cycle that is triggered when such a process runs. Note that this is the process when the default HTTP Server Input task options are used (more on how that behavior changes later):

  1. A request is received by the HTTP service.
  2. This request is converted into an XML request file along with one or more attachements when present.
  3. The XML request file and attachments are saved in a local folder, if the HTTP Action is a valid one (otherwise, the files are deleted).
  4. The HTTP service keeps the request from the client open (it does not yet respond ot it), and waits.
  5. The HTTP process corresponding to the HTTP Action captures the XML file and attachments and the process begins.
  6. The process runs its course just like any other process would (including subprocesses, send to process, etc).
  7. The very last file that is active when the process finishes is then returned to the HTTP service.
  8. The HTTP service returns the file to the client and then closes the connection.
  9. If, during this time, the timeout has expired (if the process takes more than 120 seconds), the HTTP service returns a "timeout" to the client, but the process stills finishes on its own. When the process finishes, the return file is ignored by the HTTP service.

Point 7 is critical to understand, as it has an impact on what the client receives. If a process receives a file that is split into multiple parts and each of these parts generates and output, the last split's output will be sent to the client. If the last output task generates a PostScript file for printing, this PostScript is returned to the client.

In most cases, what is returned is what remains after the last task, but only if this task's processing is done in PlanetPress Worfklow. For example, if the data file is a text file and this file is sent to PlanetPress Imaging using the Image connector, it is a text file that is returned, not the output of the Imaging. Similarly, ending a process with the Delete task does not return an empty file, it returns the actual data file.

This is actually the most used way of returning a response: Generate an HTML file using either Create File or Load External File, then delete the file as a last output. The HTML is thus returned to the client.

Example HTTP Workflows