avatar image
Former Member

error connection to odata service ODATA SAPUI5

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 :

error-json.png (18.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jan 27, 2017 at 09:37 AM

    Hi salma,

    go through below link once,

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

    Thanks

    Janu

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      hi Janu M ,

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

  • avatar image
    Former Member
    Jan 29, 2017 at 07:37 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

Skip to Content