Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Access denied Error for sap-ui-core.js in IE8 !

Hi All

I am developing a SAPUI5 application hosted on a local installation (localhost) of Tomcat server, trying to display all the sales order from the SAP ES Workplace ERP system using the SAP Demo Gateway services provided...

I am using the following REST service to fetch all Sales Order - http://gw.esworkplace.sap.com/sap/opu/odata/sap/SALESORDERS/SOHeaders

My HTML5 application is running on the local host..But when I try to run this on IE8, gives me a Access denied

But the sap-ui-core.js is indeed placed under the location mentioned above..If I write a simple application which only display some text, the same code works.

Here is the HTML code I have written

<!DOCTYPE html>

<html>

    <head>

        <meta http-equiv='X-UA-Compatible' content='IE=edge' />

        <title>Fetch Sales Order via Gateway - SAPUI5</title>

        <script id="sap-ui-bootstrap"

           type="text/javascript"

           src="../sapui5/resources/sap-ui-core.js"

           data-sap-ui-theme="sap_goldreflection"

           data-sap-ui-libs="sap.ui.commons, sap.ui.table">

           document.domain = '*.sap.com'

        </script>

        <script src="scripts/fetchsalesorder_new.js"></script>

    </head>

    <body class="sapUiBody">

    <div id="salesorders"></div>

        <div id="lineitems"></div>

    </body>

</html>

And the snippet of the script file

//supress the Same Origin Policy on IE8 & Chrome

var domainString = "document.domain";

domainstring = "*.com"

'Access-Control-Allow-Origin: *.sap.com'

'Access-Control-Allow-Headers: X-KEY'

var ODataModel = sap.ui.model.odata.ODataModel

var salesOrderService =

        "http://gw.esworkplace.sap.com/sap/opu/odata/sap/SALESORDERS/SOHeaders",

username = "GW@ESW",

   password = "ESW4GW",

oModel = new sap.ui.model.odata.ODataModel("http://gw.esworkplace.sap.com/sap/opu/odata/sap/SALESORDERS/SOHeaders")

asJson = false,

salesOrderCollection = "SOHeader";

var salesDetailsTable = new sap.ui.table.DataTable({

   title : "Available Sales Order",

   width : "100%",

   visibleRowCount : 5,

   ExpandedVisibleRowCount : 20,

   selectionMode : sap.ui.table.SelectionMode.Single,

   editable : false

  });

// connect the data table to the SalesOrder service

salesDetailsTable.setModel(oModel);

salesDetailsTable.bindRows("SOHeader");

//place table at the div element

salesDetailsTable.placeAt("salesorders");

What could be the issue here??

Appreciate any help.

Regards

Sandip

Tags:
replied

Hi Madhumitha,

I recommend to make use of the UI5 Simple Proxy servlet for local testing purposes while complying with the same origin policy. 

Have a look at the corresponding section in my UI5 on Gateway end-to-end tutorial New E2E Tutorial: Gain Hands-on Developer Experience with SAPUI5 and SAP NetWeaver Gateway. It shows how to ...

  • call and address a Gateway OData service in your UI5 app
  • use the UI5 simple proxy servlet for local testing (to comply with the same origin policy)
  • configure the web.xml file with its com.sap.ui5.proxy.REMOTE_LOCATION parameter needed fro the UI5 proxy servlet
  • implement a getUrl() helper method to get different Gateway service URLs for local testing versus running the UI5 app on the ABAP server.

Regards, Bertram

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question