Configuring for Request (Inbound) Flow
You can configure inbound messages received on a service by configuring the following:
- Supported Type: Basic, Bag
- Supported Header Source: HTTP_HEADERS
- Direction: Inbound
Add the following code after receiving the service operation response:
To retrieve a 'Basic' context parameter:
//Retrieve requestContext from componentContext which contains the inbound context parameters from Service-side RequestContext originalRequestContext = (RequestContext) componentContext.getRequestContext(); originalRequestContext.getParameter("bookNameCP", String.class));
The return value of the above getParameter()
call corresponds to the HTTP Header value of the
bookName
header (corresponding to the context parameter
bookNameCP
) in the incoming REST Request.
To retrieve the context parameter 'Bag':
//Retrieve requestContext from componentContext which contains the inbound context parameters from Service-side RequestContext originalRequestContext = (RequestContext) componentContext.getRequestContext(); HashMap<String, String> requestHeadersAllCP_service_map = (HashMap<String, String>) originalRequestContext.getParameter("requestHeadersAllCP", Map.class);
The HashMap
requestHeadersAllCP_service_map
contains all the HTTP Headers (user-defined and native HTTP Headers, corresponding to context parameter
requestHeadersAllCP
) in the incoming REST Request.