This section explains how an HTTP request is mapped to an event, and how to add an HTTP channel and destination. It assumes basic familiarity with HTTP and with the procedure of setting up a channel. See Adding Channels and Destinations if you need basic instructions.RESTMessageSerializer, which is set while configuring the channel, maps HTTP requests to BusinessEvents. HTTP headers and HTTP parameters get mapped to similarly named event properties. When both parameters and POST data are specified, then parameters take precedence.The POST data in the request must match with the payload as defined in the corresponding event. If there is no payload defined for the event, the POST data is translated into a ByteArray payload, and is not accessible via the mapper. In other words, only XML payloads are visible via the mapper.When you want the REST Serializer to deserialize a GET request into an event with a payload, include the _payload_ request parameter. The string value of the _payload_ parameter will always be used as payload in the event.
Avoid sending long requests using GET. For large payload data requests, it is recommended to use the POST method.For HTTP responses, all event properties are translated to similarly named HTTP headers and the payload is sent as HTTP content.An HTTP request URI must map to a valid BusinessEvents destination. If not, an error is returned, and the message is discarded. Once the destination is established, the HTTP message is converted either into an event based upon _ns_/_nm_, or into the default event associated with this destination.For example, the requestURI for the request https://localhost:7000/Transport/Channel/StudentDestination is /Transport/Channel/StudentDestination. BusinessEvents engine maps the request with a destination having URI /Transport/Channel/StudentDestination if it exists.To configure BusinessEvents to receive and send HTTP requests, you need to perform the following tasks:Task A Add an HTTP ConnectionAdd an HTTP Connection resource to your project. In the Host and Port fields, specify the host and port to which HTTP clients send requests.In the Host field, enter the name or IP address of the machine running BusinessEvents. This is the HTTP server.In the Port field, enter any available port on the host machine. This is the port on which the server listens for HTTP requests.To configure an HTTPS (Secure) Connection Check the SSL checkbox, click the Configure SSL button, and complete the pop-up dialog settings. The server must authenticate to the client. In the Identity field, provide the location of the Server Identity File. (See Task B).
In one-way SSL, the server authenticates itself to the client using a Server Identity File, but the client does not have to authenticate to the server.In two-way SSL, the server authenticates itself to the client using a Server Identity File and the client also authenticates to the server using the Client Identity file. Enable the Requires Client Authentication checkbox. This disables the Trusted Certificates Folder, and you need to provide the Client certificates.BusinessEvents supports use of an identity file for SSL. Before you configure the secure HTTP connection, add an Identity resource to your project and configure it.In the URL field, specify the project path of the keystore file, which must be within the project folders.In the File Type field, specify the keystore file type, and in the Password field, provide the password for the keystore file.Task C Add a Channel
2.
3. In the Method of Configuration field, select Resource. (This is enabled by default and is the only choice for HTTP channel.)
4. Browse to the HTTP connection resource you configured in Task A in the Resource field.sTask D Add a DestinationAdd a destination to the channel in the usual way. (See Adding Channels and Destinations for details.) In the Serializer field select the appropriate serializer:
HTTP clients of the BusinessEvents server would use the complete destination URI, after the host and port for example, http://www.acme.com:5560/Transport/Channel/MyDestination.Task E Create OntologyFor receiving HTTP requests and sending responses, configure events in the usual way, and by choosing an HTTP-based destination.
• Create a concept instance, using XPath functions to extract data from the POST data in the request event payload
• Create a response event and use Event.replyEvent() to send back an empty response using the request event’s default destination.As another example, in response to a GET request you might do the following:
• Identify a concept instance using a property in the request event (created on arrival of the GET request message).
• Return the data using Event.replyEvent.
Workers Setting Only Callers thread option is supported for TOMCAT based channels. This is because when a client application sends a request, TOMCAT spawns a thread to handle it. If the response is not returned on the same caller thread, then this thread returns with an empty response.You set the run-time configuration properties in the Processing Units tab of the CDD editor. See Configuring the Processing Units Tab (All OM Types) in TIBCO BusinessEvents Administration for configuration details. These properties provide information such as the location of the document root folder, as explained in HTTP Channel Configuration Properties.
Copyright © TIBCO Software Inc. All Rights Reserved.