Consume odata hosted on Amazon AWS (ABAP 7.4 MaxDB) with openui5

I implemented an odata-Service on a SAP NetWeaver Application Server ABAP 7.4 on SAP MaxDB - Trial Edition. It is hosted on Amazon AWS EC2. The odata was implemented with transaction SEGW. (I used this instruction:

I see that the odata service works, because if I input the AWS Linux external IP-adress and enter the credentials on$metadata I get information about this odata service in the browser (I use https, because the odata will be consumed in the future from a https-site)

Then I want to implement it with OpenUI5. In Chrome I use the extention "Allow-Control-Allow-Origin"

To get access to my odata service I use a similar construction as this:

var url = "http://someurl/SERVICE";
var username = "username";
var password = "password";
var oModel = new sap.ui.model.odata.ODataModel(url, true, username, password);

(I would not use the hardcoded password in a productive scenario).

So my code looks like this:

        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>

        <script src="/js/openui5/resources/sap-ui-core.js"
                data-sap-ui-libs="sap.ui.commons, sap.ui.table"


            // setting up model
            var oModel = new sap.ui.model.odata.ODataModel("", false, "AAA", "BBB");


Nevertheless the console in Chrome shows me:

OPTIONS htttps://$metadata 401 (Unauthorized) XMLHttpRequest cannot load htttps://$metadata. Response for preflight has invalid HTTP status code 401

(I wrote htttps intead of https because I can post here only a limited number of links.)

Access is also not possible in Firefox, Internetexplorer, Edge or Opera. Who can help me out here?


  • your server refuses the options request in chrome you can debug it in the developer tools network panel or by using tools like fiddler, tcpdump, wireshark

    odata requires specific headers to be sent so your browser will send an option request with those information and your browser plugin might not handle these special keywords

    your options:

    1. (best) configure your server to handle cors, more info:, I can not send you a configuration because it's server dependent
    2. create a proxy with handles cors