cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member518313
Discoverer
0 Kudos

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>

Accepted Solutions (0)

Answers (1)

Answers (1)

mantrishekar
Active Participant
0 Kudos

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.