Skip to Content

Failed to load https:/************.xsjs/collection:

Hi Folks,

I tried to read the data from oData service URL. Below is controller code and the error in the console.

Failed to load https:/************.xsjs/collection: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://webidetesting3041367-p1942892270trial.dispatcher.hanatrial.ondemand.com' is therefore not allowed access.

var serviceURI = "https://**************.xsjs/";


var username = "*********";


var password = "**********";


var OData = new sap.ui.model.odata.ODataModel(serviceURI,true ,username,password);
OData.read("/Collection", {
   success: function(oData) {
     alert(JSON.stringify(oData));
   }
});

Please check the code and error and tell me the resolution.

Regards,
Aravind
<br>
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Nov 27, 2017 at 10:26 AM

    Hi Arvind

    It looks like the service you are consuming is xsjs Service.

    When you are trying to consume xsjs service you have two options.

    1)Consume it through AJAX Call or

    2)Consume it using sap.ui.model.json.JSOnModel().

    But you are consuming them using OData Model which is not used for consuming xsjs service.If your service is .xsodata then you can consume it using OData Model,if your service is .xsjs then you consume the service using sap.ui.model.json.JSONMOdel().

    Regards,

    Shekar.

    Add comment
    10|10000 characters needed characters exceeded