Trigger/External Call
The profile can either be triggered by another profile or an HTTP request (GET or POST) via an HTTP servlet in Lobster_data, which means the profile is controlled by an event. In contrast to profiles with time-driven Input Agents, multiple jobs per profile can be processed in parallel.
The following screenshot shows how to configure the triggering via an HTTP request in a time-driven Input Agent.
(1) If this option is selected, the profile can be triggered by any other profile.
(2) Indicates whether the profile can be triggered by an HTTP request (GET or POST), see also (3), (4), (5). If this option is selected, the profile can still be triggered by another profile. Note: See also the system variables MSG_CALL_HEADER_HTTP_(...).
(3) Specifies the string with which the HTTP request must end. See below.
(4) If this option is activated, the HTTP response will not be returned until the job for the profile has ended. Attention: If the job is very time-consuming, the remote site of the HTTP request may run into a timeout.
(5) If this checkbox is set and you are using one of the custom classes PassBackDataResponse, PassBackBinaryDataResponse, DefaultWebserviceResponse or DefaultWebserviceResponseBinary, the return data of the class will be sent in the HTTP response. See also section Profile Chains. Note: This checkbox will only be active if (4) is set.
(6) Here you can specify the MIME type of the HTTP response. Note: For normal text you can use the default value text/html.
(7) Specification of mandatory parameters of requests. A detailed description can be found in section HTTP Request Parameter and HTTP Headers. Note: This is also possible with POST requests, but then the parameters must be passed in the URL as with GET.
(8) If an authentication is necessary, user and password can either explicitly be specified here. Alternatively, a partner channel can be selected, whose credentials are then used instead. See also system variable MSG_CALL_HTTP_AUTH_USER.
Procedure
For an incoming request, the HTTP servlet first looks for the right profile. All profiles that have a time-driven Input Agent with option Trigger/HTTP request and whose URL ends with (3) are searched. Additionally, the HTTP(S) request parameters must match the HTTP(S) request parameter definition (7) (see section HTTP Request Parameter and HTTP Headers). The first matching profile is selected and processing is initiated. If other profiles meet the conditions, these profiles will not be considered.
The HTTP servlet is started when Lobster_data is started and responds by default to both the HTTP context /dw/trigger and /dw/trigger. Please also see section Defining URL Context System-wide.
If, for example, you enter value myprofile in (3) and two parameters (p1=value1, p2=value2) in the parameter list (5), the URL must look like this.
http://servername[:port]/dw/trigger/myprofile?p1=value1&p2=value2 |
If user and password are set up in the profile, the profile will only be triggered after a successful login.
If triggered by HTTP, the text OK is returned to the client if the triggering of the profile was successful. It is also possible to specify the responses for success and errors in text files. The following file is searched for and if it exists, is readable and not empty, the content of the file is returned as the response to the HTTP client. Where <URL suffix> is the value in (3) and path separators / must be replaced with an underscore _.
Success |
./conf/http_trigger/<URL suffix>.ok |
Error |
./conf/http_trigger/<URL suffix>.err |
Response Status
If the profile was successfully triggered and (4) and (5) are not set, the response status is 200, even if an error occurs in the profile.
If (4) and (5) are set, the response status is 200 if the profile ran successfully. If an error occurred in the profile, the response status is always 500.
In both cases, the response status 200 can also be overwritten with the system variable VAR_RESPONSE_HTTP_HEADER_RESP_STATUS in case of success. However, only the initial value of the variable is used. Subsequent changes to the variable value are not taken into account.
Set Variables in Triggered Profile
You can set variables in the profile via HTTP request headers. For example, if the HTTP request contains the VAR_TEST header, variable MSG_CALL_HEADER_HTTP_VAR_TEST in the profile is set (must be created).