Skip to Content
0
May 20, 2015 at 05:27 AM

How to get the image from the odata

796 Views

Hi Everyone,

I'm working in SAP ui5 project here the odata contain image file as jpg format. I want to fetch the image and show it in the screen pls suggest some idea for it.

Content-Type:"image/jpeg";

Code:

get:function(){

var url = "proxy/http/71.170.170.211:8000/sap/opu/odata/sap/ZHR_APP_SRV/GetImagesSet('00800001.jpg')/$value";

var username = "arunk";

var password = "welcome01";

var oModel = new sap.ui.model.odata.ODataModel(url,false,"arunk","welcome01");

oModel.refreshSecurityToken();

oModel.setHeaders({

"X-Requested-With": "XMLHttpRequest",

"Content-Type": "image/jpeg",

"DataServiceVersion": "2.0",

"X-CSRF-Token":"Fetch"

});

oModel.read('',null,null,true,function(oData, oResponse) {

});

},