cancel
Showing results for 
Search instead for 
Did you mean: 

How Configure Dynamic HTTP header in REST Receiver Channel

Former Member

Hi All,

My scenario is PROXY to REST whereas Dynamic HTTP headers need to pass in Rest receiver channel, this header parameter.

We have write the udf for and passing the parameter values in the udf but , we confused how to configure the values in the REST refceiver channel .

UDF:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP","XHeaderName1"); DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP","XHeaderName2"); DynamicConfigurationKey key3 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP","XHeaderName3"); DynamicConfigurationKey key4 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP","XHeaderName4"); DynamicConfigurationKey key5 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP","XHeaderName5"); conf.put(key1, var1); conf.put(key2,var2); conf.put(key3, var3); conf.put(key3, var4); conf.put(key3, var5); return "";

How To configure in the receiver REST channel ?

Pleas help us to achiv the same.

How to pass header name and Value Pattern in the receiver communication cahnnel.

venkatasap
Participant
0 Kudos

i have created the UDF with the above source code in the ESR->graphical mapping tool.but iam sure if i need to map this udf with any of the target message type.also i want to know about how this udf will be used in the receiver Rest communication channel ?.

regards.

varma mandapati

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Anju,

First we need to do the cahnges in above UDF. Rename the SAOP with REST.

Communication channel configuration's are like below.

note : It will accecpt only the "_" values not "-"

In Additional Http Header :

Hope it will help you.

Regards

Ravi.S

7893366122

SushantShinde
Advisor
Advisor
0 Kudos

Hello Ravi,

I am trying the same thing, u no success for me, if you can help me. please reply here

Regards,

Sushant

former_member211899
Participant
0 Kudos

Hi,

Thanks for this explanation, i was able to pass the Authorization Parameters via Dynamic Configuration.

However, the value of the parameters are visible in the message audit log (RESTOUT_HTTP_HEADER).

Is there anyway the Authorization Parameters can be passed in the HTTP Header as masked ?

Regards,

Krishna

0 Kudos

Anyway to do the same from REST Sender adapter? Basically I want to dynamically assign HTTP Header value which can get these values from PI Mapping result.

Answers (3)

Answers (3)

0 Kudos

Hi Ravinder, can you please explain how did you achieve this ?

Former Member
0 Kudos

I have done my self to slove the above issue.

rasjoshi
Active Contributor
0 Kudos

Hi S RAVINDER,

I am getting access_token from REST lookup and now I am trying to add dynamic attribute and assign it a value of the acquired access token....

Could you please help me here?

my UDF for dynamic config -

finally{ // 5. close the accessor in order to free resources. if (accessor!=null) accessor.close(); } //return token; //Dynamic Configuration DynamicConfiguration dynConf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/REST", "XHeaderName1"); dynConf.put(key, token); return "";

However, my UDF is giving error while testing -

Exception:[java.lang.NullPointerException: while trying to invoke the method com.sap.aii.mapping.api.DynamicConfiguration.put(com.sap.aii.mapping.api.DynamicConfigurationKey, java.lang.String) of a null object loaded from a local variable at slot 8] in class com.sap.xi.tf._MM_SFDC_RESTAPI_QUOTE_STATUS_UPSERT_REQ_V1_ method newAccessToken[com.sap.aii.mappingtool.tf7.rt.Context@30f2539]
See error logs for details

If I remove dynamic config line my code is giving me access_token value successfully..

How can I pass this access_token value to synamic attribute and later use it in REST receiver adapter to add custom http header value?

BR,

Rashmi

0 Kudos

How you achieve this?I have also the same requirement.

Harish
Active Contributor
0 Kudos