Web processes with OL Connect tasks
Serving a web page, made with a template, via an automated process requires you to design a web process in the PlanetPress Workflow configuration tool.
This topic explains which tasks and files are used in a web process.
An easy way to start an OL Connect web project including the web process and the files that it needs, is to use a Sample Project. There are two Sample Projects that generate a sample web project. See Sample Projects.
The structure of a web process
In a web process two plugins are essential:
- An Input task.
- The Create Web Content plugin.
If the Input task is a Server Input task, that task will return the output of the process - the web page - to the caller.
The HTTP Action of the Server Input task determines how the process is triggered. If, for example, the HTTP Action is /hello, the process will be invoked when the Workflow server receives a request for a resource called hello. (You could, for example, trigger the process by typing the following URL in the address bar of your browser: http://localhost:9090/hello, if the browser runs on the same machine as the Workflow server and the Input task is a NodeJS Server Input task. The protocol could be HTTPS, depending on the settings of the Input task.)
To trigger the process from a Web Form, set the Action of the Form to the HTTP Action of the Input task. (See Forms.)
The Create Web Content task creates an HTML output file from the Web context in a template.
Select the Web template in the task's properties.
If the Web template doesn't need any data, you can set the Data Source of this task to JSON and enter an empty JSON string: {}, or set it to Record ID and enter 0 (zero).
However, if the template should be merged with data, the task needs either a valid Record ID or a JSON object. In that case, one or more steps must be added to the process to provide the required data. For example:
- An Execute Data Mapping task that retrieves data from the job file (such as the request XML). This task outputs one or more records to the Metadata. By default, the Create Web Content task uses the first Record ID from the Metadata.
- A Retrieve Items task that retrieves an existing record from the OL Connect database and outputs it in the Metadata or as JSON object.
Which task or tasks fit best, depends on where the data must come from.
Of course, numerous other tasks could be added to the process. If you'd want to save the output of the Create Web Content task - the web page - to a file, for example, the task would have to be followed by a Send to Folder task.
The Create Web Content task can be found on the OL Connect tab of the Plug-In Bar in Workflow.
For a description of all mentioned OL Connect tasks, see OL Connect tasks.
Files used in a web process
Before creating the web process in the Workflow configuration tool, you will need to create:
- A template with a Web context. (See Creating a template.)
- If the web page should contain variable data, you might need to make a data mapping configuration (see Creating a new data mapping configuration). If the input is going to be JSON data, you could add them to the design using a JSON file (see Adding JSON sample data).
Templates and data mapping configurations need to be sent from the Designer to PlanetPress Workflow before they can be used in the Workflow process; see Sending files to Workflow.
The next step is to create a process in PlanetPress Workflow that generates Web output, using these files.
For more information about how to create a process in Workflow, please refer to the Online Help of Workflow.