on 08-29-2017 11:32 AM
Hello,
I am designing a SAPUI5 Application on SAP HANA XS in which I want to use a ODATA service from separate Gateway Server (using http). I tried by passing credentials also in OData Model but still call is unsuccessful.
I am testing this in Google Chrome and no pop-up comes to enter Credentials.
var url ="http://hostname:50000/sap/opu/odata/sap/ZDEMO_ODATA_SRV/";
var oModel = new sap.ui.model.odata.ODataModel(url,false,"Username" ,"Passsowrd");
//Also tried :
//var oModel = new sap.ui.model.odata.ODataModel(url,false,{user:"Username"
// ,password:"Passsowrd"});
var path = "/REG_SalesSet";
var that = this;
oModel.read(path, null, function(oData, oResponse){
var model = new sap.ui.model.json.JSONModel(oData.results);
this.setModel(model);
});
normally if your app is hosted in serverA, you can only call odata service from serverA. if you want to call odata from serverB, you need proxy to do the job for you.
google SOP, CORS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can install a chrome plugin name as "CORS" and turn the setting ENABLE. It will work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.