cancel
Showing results for 
Search instead for 
Did you mean: 

Application redirects to XSOdata service metadata URL

0 Kudos

UI5 App deployed on local apache server. An Odata call is made in the onInit method. As soon as the service gets called, an authentication popup is created for the HANA system. The issue is that the application URL in the browser gets replaced with the actual XSODATA service URL after entering the username and password. Ideally the UI5 page should be called again after the authentication, but the URL in the browser stays at the XSOdata metadata.

UI5 Code :

var url = "https://abcde.xsodata/";

var oModel=new sap.ui.model.odata.ODataModel(url,true); oModel.read("/entitysetname(1)", null, {},false, function(data){ console.log(data) },function(error){ console.log(error) });

XSOData code( In the xsaccess file) :

{

"exposed" : true,

"authentication" :

{

"method": "Basic"

},

"cache_control" : "must-revalidate",

"xhrFields" : { "withCredentials" : true},

"cors" :

{

"enabled" : false

},

"enable_etags" : false,

"force_ssl" : false,

"prevent_xsrf" : false

}

Would be grateful if someone could help out with the redirection issue.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member227918
Active Contributor
0 Kudos

why not model declaration in config file?

not sure, try request using proxy once

0 Kudos

I'm not sure what you mean. could you elaborate? I'm new to consuming xsodata in ui5

CristianBabei
Contributor
0 Kudos

Hello,

Why you are not using OData model v2?

var oModel = new sap.ui.model.odata.v2.ODataModel(URL);
oModel.read("/InfoSet",{
        success: function (oData){
             //success
        },
        error : function(oEvent){
             //...
        }
});
    

Check it here

Hope this can help you.

Regards.

0 Kudos

I had tried with v2 model as well and got the same output