SAP Knowledge Base Article - Public

2446404 - Steps to Set up a Rest call with Required Cookies to call OData Service from Process Orchestration tool

Symptom

Rest adapter is capable to transfer the HTTP Request/Response headers as dynamic attributes of the XI message and set HTTP Headers values reading dynamic attributes of the XI message. You can use this to make your scenario work.

Environment

SAP Hybris Cloud for Customer

Resolution

1) In Fetch token Rest Sender channel, in the tab Result HTTP Header make new Values Source with selecting Message Attribute from drop-down, Message Attribute Name set-cookie and Header Name Cookie. With this option, you will fetch the set-cookie dynamic attribute of the Response XI message and pass it as Response Http Header Cookie.

1.png

 

2) In Fetch token Rest Receiver channel, in Http Headers tab you should have Header with name X-CSRF-Token and value Fetch. Rest adapter will pass by default all Http Response Headers as dynamic attributes of the XI message.

REST_2.png

XI Dynamic Attribute fetches the X-CSRF-Token

REST_three.jpg

 

3) In Rest Sender channel, in Rest Resources tab in section XI Dynamic Attribute change dynamic attribute section with the value Custom Attribute from the drop-down menu. Set the custom attribute name with value by your choice (ex. request-cookie), set Value Source by selecting the value HTTP Header Variable from the drop-down list. Enter a HTTP Header element value Cookie (the same value name passed from the Fetch token source system as Response).

1.png.jpg

 

4) In Rest Receiver channel, in Rest URL tab in section Pattern Variable Replacement for Value Source select Adapter-Specific Attribute from drop down list. For Pattern Element Name type name by your choice (ex. req). For Adapter-Specific attribute select Custom Attribute from the drop-down options. As Attribute name enter the same name from the Custom Attribute in the Rest Resources tab from the Rest Sender channel.

REST_five.jpg

 

5) In HTTP Headers tab you must create Header with name Cookie (name this Header as it is expected from the C4C OData service) and enter for a Value Pattern the name of Pattern Element from previous step in curly braces (ex. {req}). You can use the same steps for each Header (Cookie) which should be fetched and passed with next Rest call.

REST_six.jpg

6) Save and Activate all channel changes.

 

You may refer to the attached PDF document to understand how to setup the HTTP Header Parameters.

Keywords

REST call, Process Orchestration tool, REST Sender channel, REST Receiver channel, How to Set HTTP Header Parameters, Cross-Site Request Forgery , KBA , rest call , process orchestration tool , rest sender channel , rest receiver channel , how to set http header parameters , BC-XI-CON-RST , Rest Adapter , How To

Product

SAP Cloud for Customer add-ins all versions

Attachments

How to Set HTTP Header Parameters.pdf