Skip to Content

This blog is to illustrate following solution which might be helpful in certain scenario:

     1. Set Custom HTTP Header in sapui5

     2. Get Custom HTTP Header in Gateway

So Let’s start !

1. How to set custom HTTP Header in sapui5


This is simple and can be achieved by setHeaders method of either sap.ui.model.odata.v2.ODataModel or sap.ui.model.odata.ODataModel.

Code snippet:

UI5 Code.JPG

Able to see customer header sets in F12:

     F12 in Chrome.JPG

2. How to get custom HTTP Header in GW


Also simple by calling get_dp_facade of interface /iwbep/if_mgw_conv_srv_runtime.

Code snippet:

     GW Code Snipet.JPG

Able to see in GW code runtime:

     Header in GW.JPG

Now we able to set HTTP custom header in UI5 and get in GW.

This is sometimes helpful when you want to pass additional data from UI to GW but found nowhere to place them.

e.g. When implement get_entity/get_stream method, few places we can put parameters. Then maybe header is a place to consider.

Hope it helps !

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply