Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

401 unathorization error while calling Odata service from UI5

$
0
0

I have implemented a getEntity method in my DPC class to return the data of the selected employee. I tested the service in the browser with the following url and it shows me correct data as expected. (In below eg , for employee no 002)

 

ui5-1.JPG

 

Now I want to bind the NAME of the employee shown above to a textfield(inp1) in UI5. For that i wrote the code in eclipse as follows

 

createContent : function(oController) {

var oData = new      sap.ui.model.odata.ODataModel("http://ehp7prd.sap.in:8200/sap/opu/odata/sap/ZEMPLOYEE_SRV/EMPSet('002')",false,"fioriconfig","Bharath123");

sap.ui.getCore().setModel(oData);

var oFlowLayout = new sap.ui.layout.ResponsiveFlowLayout({

                             responsive : true  // boolean

  });

  var inp1 = new sap.ui.commons.TextField("txt1");

  inp1.bindProperty("value","Name");

      

       var inp2 = new sap.ui.commons.TextField("txt2");

 

But when i execute the index.html , I can just see the empty text field without any value. On Checking the console i see 401 error as follows

 

ui5-2.JPGPlease help me out to resolve this issue. Thanks


Viewing all articles
Browse latest Browse all 6178

Trending Articles