Skip to Content
0
Jul 16, 2019 at 07:03 AM

How to add a custom header field to http request in SAP WEB IDE UI5 App?

1293 Views

Hello,

I want to consume a webservice in my SAPUI5 app. This service is require a custom header field in HttpRequest to process business. I've already configured a destination for webservice and used XMLHttpRequest to send request. the following are my javascript UI5 code:

var xhr = new XMLHttpRequest(); 
xhr.withCredentials = true; 
xhr.open("POST", "/myDestinationPath/myWebService", true); 
xhr.setRequestHeader("Content-Type", "application/json"); 
xhr.setRequestHeader("myCustomHeader", "customHeaderValue"); 
xhr.send(JSON.stringify(myBodyData));

My Issue is:

My webservice didn't get custom header field in HttpRequest that was sent from my UI5 app.

(I have used Fetch API and ajax but had the same issue)

So are there any solutions for this problem ?

Thank you for your help !