Skip to Content

'No 'Access-Control-Allow-Origin' header' error when calling odata service

Sep 22, 2017 at 09:32 AM


avatar image
Former Member

Hi there,

I'm developing on SAP webIDE for SAP HANA, and I created 2 MTA projects, respectively with an SAPUI5 module and odata service mdoule inside.

Now I try to call cross-project odata service from my UI project:

<code>var myServiceUrl = "";
var categoryModel = new sap.ui.model.odata.v2.ODataModel({serviceUrl:myServiceUrl});
this.getView().setModel(categoryModel, "categoryModel");

but got an error saying "XMLHttpRequest cannot load$metadata. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access."

Anyone know where to add header "Access-Control-Allow-Origin": "*" for xsodata service response?


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

1 Answer

avatar image
Former Member
Sep 28, 2017 at 02:40 AM

Issue fixed.

See :

10 |10000 characters needed characters left characters exceeded