-
Notifications
You must be signed in to change notification settings - Fork 0
HTTP Forwarding Filter
Task: An existing workflow in the Xyna Factory shall be published as a REST Interface
When you have a workflow in Xyna, which is used internally and has not yet a public interface, there are different possibilities to publish this workflow, so that it can be called from outside the factory via a HTTP REST call.
One of those possibilities is the usage of the Xyna "HTTP Forwarding Filter", which is delivered as a part of the http application.
Prerequisites:
- The http application is installed. In this tutorial the version 1.2.5 of the http application is used
- The workflow, that shall be published, is present in the system and is tested in a local environment. In this tutorial we use the Workflow "Get Webpage". This wokflow gets a filename as an input and delivers the contents of the locally stored file as a string. We assume, that the workflow is deployed in a workspace named "Webpage_Impl_WS".
The following steps do the job:
-
Create Trigger Instance using the existing HTTP Trigger, delivered with Xyna:
./xynafactory.sh deploytrigger -workspaceName 'Webpage_Impl_WS' -triggerName Http -triggerInstanceName Http_OAS4220 -startParameters port=4220
This command creates a trigger instance with name "Http_OAS4220", which listens to the port 4220. This trigger instance is deployed in the same workspace as the workflow.
Alternatively, you can create the trigger instance via the GUI (Factory Manager / Trigger):
-
Create Filter Instance using the existing HTTPForwarding Filter, delivered with Xyna:
./xynafactory.sh deployfilter -filterName HTTPForwardingFilter -workspaceName Webpage_Impl_WS -triggerInstanceName OASEntry_4220 -filterInstanceName Webpage_Forwarding
This command creates a filter instance with name "Webpage_Forwarding", which is connected to the trigger instance "OASEntry_4220" we created in step 1. This trigger instance is deployed in the same workspace as the workflow.
-
Create a dispatcher workflow, which can be called by the new filter instance. The tasks of the workflow (in our case named "Get Webpage Dispatcher") are:
- Fulfill the signature which is needed by the filter instance.
- Input-Parameters: xact.http.URL-path, base.host, base.Port, xact.http.enums.httpmethods.HTTPMethod, xact.http.Header, xact.templates.Document
- Output-Parameters: xact.templates.Document, xact.http.Header, xact.http.enums.statuscode.HTTPStatusCode
- Call the workflow you want to publish
- Fulfill the signature which is needed by the filter instance.
-
Create the ordertype in the Factory Manager, which maps the incoming requests to the dispatcher workflow:
- Name: xact.http.ProcessHTTPRequest.port=4220 (port value must be the value used for the trigger instance)
- Execution Destination: Full qualified name of the dispatcher workflow (the one created in step 3)
-
Test the filter: You can test your filter setup using cURL via the example command:
curl --location 'http://<your server address>/hello1.html'