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 '' 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);"/Collection", {
   success: function(oData) {

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

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().



    Add comment
    10|10000 characters needed characters exceeded