Skip to Content
0

How Configure Dynamic HTTP header in REST Receiver Channel

Dec 14, 2016 at 06:29 PM

2.2k

avatar image
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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
avatar image
Former Member Mar 07, 2017 at 11:22 AM
0

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


Share
10 |10000 characters needed characters left characters exceeded
Harish Mistri Dec 14, 2016 at 11:02 PM
0

Hi,

Please check the below blog for dynamic configuration attribute in Rest adapter

https://blogs.sap.com/2015/04/14/pi-rest-adapter-define-custom-http-header-elements/

https://blogs.sap.com/2014/12/18/pi-rest-adapter-using-dynamic-attributes/

regards,

Harish

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 17, 2017 at 10:05 AM
0

I have done my self to slove the above issue.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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
avatar image
Former Member Mar 03, 2017 at 11:03 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded