HTTP Server Input
Note: This plug-in has been moved to the Legacy group.
HTTP Server Input tasks are used to receive HTTP requests made via GET or POST commands and to send replies to the servers from which the requests were made. The HTTP server supports both HTTP and HTTPS. For HTTPS Support information, see HTTP Server Input plugin preferences 1.
Instead of using the HTTP Server Input task, you should consider using the NodeJS Server Input task which is more secure, more up-to-date and more standardized. For more information see: NodeJS Server Input.
Note: While you can insert the HTTP Server Input task anywhere in your process as a secondary input task, in reality the HTTP Server Input task will only function when used as the initial input, as it is triggered when OL Connect Workflow HTTP Server receives a request and passes it on to the correct task.
Note: Athough Workflow can serve both static and dynamic resources to a web browser, 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 recommended to use a common web server (for example, IIS or Apache) to serve your contents and to let Workflow process things only it can do.
For more information on how to serve HTML and PDF generated by Connect through IIS, watch the Connect with Evie - IIS series.
Caution: It is highly recommended to make all processes using the HTTP Server Input task self-replicating and to reduce their polling interval in the Process properties.
Examples
This task is put into effect in the following example processes:
Note that Capture can only be used with PlanetPress Suite.
Input
The HTTP Server Input task does not, by itself, capture any files. Neither does it directly wait for requests to be received. Actually, it is the HTTP service that receives the requests and places them in a specific location on the drive. When a request is received, the HTTP Server Input polls that location and finds the requests and all attachments. It will always pick up the "oldest" request received.
The request can contain one or more files, one being an XML file containing the request information as well as any GET or POST variables that were received within this request. Other files are POST attachments.
Note: By default, the request XML also contains a CDATA section which contains the raw input data, effectively doubling the size of the incoming file. Due to technical restrictions, the incoming XML file cannot be more than 400MB, which because of CDATA is reduced to around 200MB. To help in this situation, you may elect to omit from the attachment, which can be changed in HTTP Server Input User Options. Please note that incoming binary files (sent through file upload in a form) can never be larger than 400 MB.
Processing
Depending on the options chosen in the HTTP Server Input task properties, the task may choose to ignore some of the files. For example, using the "Do not include XML envelope" means that only the POST attachments will be used in the process, the XML file will be discarded. Attachments are always saved on disk in a specific location, which is accessible either directly in the XML or directly as a data file through the "Loop each attachment as data file" option.
Output
At first, the output inside the process itself is, depending on the selected options, an XML request file, POST Attachments files, either one or both.
If the Send Immediate Response to client option is selected, the response file is sent back right away and the involvement of the input task ends then.
However, if this option is not checked, it means there is a second output that comes out of the HTTP Server Input task: The last output generated by OL Connect Workflow is sent back to the initial input, which is returned back to the client (see Request/process/response cycle).
Even if the process ends with a Delete task, it is still returned to the client; deleting the job file only means you are not doing anything with it locally.
Note: You can serve static resources through OL Connect Workflow, which is especially useful for images, CSS and JavaScript files. See HTTP Server Input plugin preferences 2.
Task properties
General Tab
- HTTP action: Enter the name of the action requested of OL Connect Workflow by the client. This name corresponds to the URL that the client will be accessing. For example, if you enter "MakePDF" here, you could trigger the process by accessing http://127.0.0.1:8080/MakePDF . This is also what your HTML Form's action should be.
- MIME Type: Select the MIME type of the file that will be returned by the plugin.
- Loop each attachment as a data file: When receiving attachments through a POST request (HTML Form), this option will make the HTTP Server Input task loop through each attachment. Each data file is an XML with the accompanied file.
- Do not include XML envelope: Only active when the previous Loop option is checked. When checked, the XML file containing the request data will not be available. Only the attachment itself is sent as a data file.
- Respond on error: Enter a message to be sent to the client as the output file if the process encounters an error and is unable to send a reply that includes the actual output file. The information can be in any desired format such as HTML or plain text. However, if it must be displayed in a browser, the format should match the selected MIME type.
This is a variable property box. You can use any combination of text, variables and data selections; see Variable task properties. - Send immediate response to client: Do not wait for the process to finish and send a static HTML or Text file back to the client instead. This prevents any timeout from occurring. When checking this option, the field under the option is used to select which file to return.
- Use custom HTTP server response code: When the process ends and a response is sent to the requesting client, a custom response code can be specified depending on how the process goes. While in previous versions the "200 OK" code was always used, this option overrides it to, for example, "404 Not Found" or "401 Unauthorized".
Note: The response code must start with 3 digits, followed by a space and then the error message. If the first few characters can't be converted to a valid number, the server automatically returns "500 Internal Server Error", regardless of the actual response code provided by the process.
- Variable containing the response code: The contents of the job information or local variable selected in this drop-down, presumed to be a valid response code, will be returned in the response header. This is the value that is present at the end of the process, not the beginning.
Note: In order to make the Capture OnTheGo app delete the submitted form from the device's library upon successful transmission of the data, the Workflow process must return status code 291. The standard 200 response leaves this up to the COTG user or the expiry date of the form.
Note: This option requires every plugin in the process to be explicitly set to "On Error: Stop process" (see Using the On Error tab), even if the process itself is set to "On Error: Stop process".
"Other" Tab
- Job Information group
- Information elements: Indicates what Job Info variables are automatically created by the input task.
- Add lines before first data page: Using the arrows keys you can add any job information directly at the beginning of your data file.
- Backup input files: Check this to save a copy of each data file that is captured by your input. These files are saved in the OL Connect Workflow Tools working folders under the "Backup" folder.
To navigate quickly to the Workflow working folders, press the keyboard shortcut CTRL+ALT+Shift+F4 from within the Workflow configuration tool.
The number of days to keep backups of jobs processed by input tasks is set per process; see Process properties. - Backup filename: Enter the file name that you wish the input data file backup to be saved under.
- Delete Existing Metadata: Check to remove any Metadata from memory. This option is disabled on initial input tasks, and is checked by default on secondary input tasks.
Job Information definitions
- %1 - Client IP Address: Contains the IP address of the HTTP client requesting a response.
- %2 - Request Header: Contains the headers of the request, which can contain information such as the Browser and Operating System, languages, etc.
- %3 - Filename: Contains the local file name of the job file created by this task (and XML file). This is equivalent to %o.
- %4 - Attachment Index: Contains the index number of the current attachment while looping the attachments as data files (zero based; when processing the request file, the Attachment Index is 0; with the first attachment it is 1, etc.). When the option Loop each attachment as a data file is not checked, the Attachment Index is 0.
On Error Tab
For a description of the options on the On Error tab see Using the On Error tab.
Miscellaneous Tab
The Miscellaneous tab is common to all tasks.
It contains a text area (Task comments) that lets you write comments about the task. These comments are saved when the dialog is closed with the OK button and are displayed in The Task Comments Pane.
Check the option Use as step description to display the text next to the icon of the plugin in the Process area.
The tab also provides an option to highlight the task in The Process area with the default color, set in the Preferences (see Colors), or the color selected or defined under Highlight color on this tab.
To revert the selected highlight color to the default color, open this tab, turn the Highlight option off and close the dialog with the OK button; then turn highlighting back on.
Highlighting can also be turned on and off via the task's contextual menu and with the Highlight button on the View ribbon.