on 2021 Jul 26 9:03 PM
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,
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:/"+"/sap.com/xi/XI/System/REST","XHeaderName1");
DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/REST","XHeaderName2");
DynamicConfigurationKey key3 = DynamicConfigurationKey.create("http:/"+"/sap.com/xi/XI/System/REST","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.
Hi Rajesh,
Are you finish this requirement, I got one just like this rencently.
It's thansful for ur reply.
regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
stefan.grube -
Hi Stefan, Sorry for coming back very late on this ! I took another approach of performing the REST lookup in Java code itself and it worked. However, can you please confirm if the above approach wont work even now, considering a year has passed by? Maybe some further patches from SAP might help make this work now ?
Or maybe a different approach using SAP PO standard objects, please share your inputs !
Thanks, Rajesh
Hi Rajesh,
dynamic values are not supported for mapping lookups, no matter which adapter is used.
If the REST adapter is used for GET operation, the values could be stored in the payload.
Otherwise it is not easy
User | Count |
---|---|
62 | |
9 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.