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 TIBCO BusinessEvents. HTTP headers and HTTP parameters in the GET method are mapped to similarly named event properties. When both parameters and headers are specified, parameters take precedence.Each HTTP Header consists of a name and field value, which are mapped into an event property name and value.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.The transfer encoding (charset) in the Content-Type header indicates what type of transformation is applied to the POST data (message body) to safely transfer content between sender and recipient. If the Content-Type header is missing, UTF-8 is used as the default transfer encoding.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.To send non-ASCII event properties in GET methods, use HTTP parameters. HTTP parameters are passed as the QueryString of the request URI, that is, the part of the URI that contains data to be passed to web applications.To decode the QueryString, use either the URI Encoding or the body encoding. The body encoding is specified in the contentType HTTP header.Select either the URI Encoding or Use Body Encoding for URI setting in the HTTP channel Advanced tab.An HTTP request URI must map to a valid TIBCO 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.In this case TIBCO BusinessEvents server looks for the destination having the same URI as the requestURI.For example, the requestURI for the request https://localhost:7000/Transport/Channel/StudentDestination is /Transport/Channel/StudentDestination. TIBCO BusinessEvents engine maps the request with a destination having URI /Transport/Channel/StudentDestination if it exists.To configure TIBCO 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 TIBCO 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.Check the Requires Client Authentication checkbox. This enables the Trusted Certificates Folder field, where you provide the Client certificates.TIBCO 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 an HTTP Channel
1. At the New Channel Wizard, provide a name and description, and in the Driver field select HTTP. Click Finish.
2. In the Channel editor Channel tab, update the description as desired. The Driver field is set to HTTP (as set in the wizard). The Method of Configuration is preset to Resource and can’t be changed.
3.
5. Click Advanced, and configure run-time configuration properties. These properties provide information such as the location of the document root folder. Some properties are for SSL configuration of HTTP Component servers. See HTTP Channel Advanced Configuration Settings.Task 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 TIBCO BusinessEvents server would use the complete destination URI, after the host and port for example, http://www.acme.com:5560/Transport/Channel/MyDestination.For receiving HTTP requests and sending responses, configure events in the usual way, and select an HTTP-based destination as the default 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.In the Cluster Deployment Descriptor (CDD) Configure the processing unit for deployment as needed (see Chapter 3, CDD Configuration Procedures for details). Note the following requirement.
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.
Copyright © TIBCO Software Inc. All Rights Reserved.