Configuring for Request (Inbound) Flow
You can configure inbound messages received on a service by configuring the following:
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 above getParameter() call corresponds to the HTTP Header value of the bookName header (corresponding to context parameter bookNameCP) in the incoming REST Request.
To retrieve 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.
Copyright © 2022. Cloud Software Group, Inc. All Rights Reserved.