Skip to Content
Jul 26 at 08:03 PM

SAP PO 7.5 REST Lookup - Issues in passing dynamic values in HTTP Header and custom Error handling


Hi All,

I am working on a JMS to PROXY flow in which we have got a requirement to perform REST Lookup in the message mapping by passing dynamic values(some from incoming payload and some determined by small logic) in HTTP Header of the REST Lookup call. Also, I need to print the response(custom error log) from the REST Lookup in case the HTTP response code is not 200 (for any type of error code) and fail the message. I have some issues mentioned below, kindly share your inputs.

I have tried to put the incoming variables and some other logic determined values in Dynamic Config in mapping UDF and fetch them in REST Receiver channel and map them in HTTP Header section, but what I see is,

  1. The values are set properly and visible in Dynamic config in main message (incoming payload), but in the Lookup channel it shows as BLANK as shown below. So no values are passed to REST API and it returns error each time. This setup works fine in POSTMAN tool.

Lookup channel log is below,

I tried to validate if the Dynamic config is having issues or not by creating a REST to REST flow and see that the values are set properly in main message.

Below is the code from UDF,

AbstractTrace trace = container.getTrace();
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//put header params in dynamic configuration.
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http:/"+"/","XHeaderName1");
DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http:/"+"/","XHeaderName2");
DynamicConfigurationKey key3 = DynamicConfigurationKey.create("http:/"+"/","XHeaderName3");
conf.put(key1, DocType);
conf.put(key2, msgId);
conf.put(key3, BusinessID);
return "";

And below is the config in REST Lookup channel,

2. I also need to catch the response from the REST Lookup to add it in the Audit log of main message and fail it in case of error, but the above error log is not available in main message. Below is the setup in REST Lookup channel in last tab. I only get a single string value for {http_result} in response payload. Is there any specific thing like creating the below structure as a separate external def or DT and use it?

3. Once I sort 1st issue, get error code from 2nd point, how to pass the above error log in Audit log, kindly let me know. I tried to follow this link and related notes and params in Module tab, but still no luck.

Thanks and regards,

Rajesh S.