cancel
Showing results for 
Search instead for 
Did you mean: 

error connection to odata service ODATA SAPUI5

Former Member
0 Kudos

hello everyone ,

please i have an error when running my sapui5 application and it can connect to my odata services :

this is below the code that i put to my component.js

var domainString = "document.domain";

domainstring = "*.com";

'Access-Control-Allow-Origin: http://localhost:*';

'Access-Control-Allow-Credentials: true'; 'Access-Control-Allow-Headers: X-KEY';

var oModel = new sap.ui.model.json.JSONModel("http://servnsissap09.wynsys.local:8000/sap/opu/odata/sap/ZHS_SANOFI_WM_SRV/WINNOV_VEKPSet?$format=json",false,"[username]","[password]");

oView.setModel(oModel);

and this is the error that i have :

Accepted Solutions (0)

Answers (2)

Answers (2)

jmargieh
Explorer
0 Kudos

If you're doing an XMLHttpRequest to a different domain than your page is on. the browser will not allow request of different origin.

If you're using the same origin and still face this error:

try using this chrome extension:
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi

Btw did you try running your app in Firefox ?

Best

Jawad

0 Kudos

Hi salma,

go through below link once,

https://archive.sap.com/discussions/thread/3380807

Thanks

Janu

Former Member
0 Kudos

hi Janu M ,

Thank you for your relply but i already see this post and tried this code and still the same problem 😞