HTTP Requests and Events with the REST Serializer
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.
For HTTP responses, all event properties are translated to similarly named HTTP headers and the payload is sent as HTTP content.
Sending Non-ASCII Content to Event Properties
The HTTP 1.1 specification states that only ASCII characters can be sent in HTTP headers.
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.
Mapping of HTTP Request URI to Destination
An HTTP request URI must map to a valid TIBCO BusinessEvents destination. If not, an error is returned, and the message is discarded.
In the event based approach, 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.