cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Header paramets in SAP PI 7.3

bhargava_dns
Participant
0 Kudos
375

I have a requirement to connect third party webservice using REST for which the access token need to be passed in the header parameter.

when the access token is passed in the static forms I was able to establish the communications , but when the token is passed dynamically I am unable to establish communication , I am getting unauthorized error.

The following is the java code that I have used for dynamic mapping.

DynamicConfiguration conf = transformationInput.getDynamicConfiguration();
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/REST","pspRefNo");

conf.put(key, pspreq);

byte[] byteArrray = encryptedString.getBytes();
outputstream.write(byteArrray);

View Entire Topic
former_member285898
Participant
0 Kudos

Hello Bhargava,

You can try below UDF code, where define 'token' value/parameter as a String.

-----------------------------

Code:-

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/REST","pspRefNo");

conf.put(key1, token);

return "";

------------------------------

Also as mentioned by Stefan, you defined Value pattern as 'Bearer<token>', instead of that you need to define value pattern as 'Bearer {token}'.

Dynamic value is always passed with {} brackets only.

I Hope it will help you out.

Regards,

Karan K