user5601025
user5601025

Reputation:

SAPUI5 OData 401 (Unauthorized) + No Access-Control-Allow-Origin Header

I work in SAP Web IDE to develop an SAPUI5 application which uses OData Service CUAN_IMPORT_SRV.

I start by defining the OData Model this way:

var oModel = new sap.ui.model.odata.v2.ODataModel("https://host:port/sap/opu/odata/sap/CUAN_IMPORT_SRV/", true, "UNAME", "PASSWORD");

Username and Password can access the data and do read + create operations on Hybris Marketing. This is tested with Postman.

However, when I try to test my application with Test Fiori Launchpad, I get this error message when executing the OData call:

F12 Console Error

Concering this topic, I read some other posts and tried to edit the URL to

proxy/https/host:port/sap/opu/odata/sap/CUAN_IMPORT_SRV/

...but this results in 404 Not Found.

Since I use Chrome as Browser, I disabled web security as I read in other posts. This did not work. That's why I tried this Chrome AddOn. As a result, I got this error log:

F12 Console after using AddOn

What more can I try to solve this issue? Thank you for any advice!


Tried configuring destination in Cloud Platform:

destination configuration

Upvotes: 0

Views: 5220

Answers (1)

Piyush aggarwal
Piyush aggarwal

Reputation: 772

Web IDE does not allow Cross Origin access. In order access your ODATA service from Web IDE, you have to use Cloud Connector.

Cloud connector will create a ternel between AP Cloud platform and your ODATA Service Gateway System.

Follow these steps: https://blogs.sap.com/2014/06/22/how-to-configure-an-external-gw-system-with-sap-river-rde/

enter image description here

Upvotes: 0

Related Questions