Hello Techies, Recently i created one fiori like apps project. I want to consume external oData Northwind Service. So, that i created a model in my componenent.js file by passing the northwind OData service URL.
jQuery.sap.declare("path.Component");
sap.ui.core.UIComponent.extend("path.Component",{ metadata: { routing : { config : { viewType: "JS", viewPath: "path.views" }, routes: [{ pattern: "", name: "master", view: "Master", targetAggregation: "masterPages", targetControl: "myApp" }, { pattern: "simple", name: "empty", view: "SimpleDisplay", targetAggregation: "detailPages", targetControl: "myApp" }, { pattern: "Product/{spiderman}", name: "detail", view: "Details", targetAggregation: "detailPages", targetControl: "myApp" }] } },
});
ironman.Component.prototype.init = function()
{ sap.ui.core.UIComponent.prototype.init.apply(this); jQuery.sap.require("sap.ui.core.routing.History"); jQuery.sap.require("sap.m.routing.RouteMatchedHandler"); var oRouter = this.getRouter(); this.routeHandler = new sap.m.routing.RouteMatchedHandler(oRouter); oRouter.initialize(); oRouter.navTo("master");
// oRouter.navTo("empty");
};
ironman.Component.prototype.destroy = function()
{
};
ironman.Component.prototype.createContent = function()
{ var oMainView = new sap.ui.view({ id: "idMain", viewName: "ironman.views.MainApp", type: "JS" }); var oData = new sap.ui.model.odata.ODataModel("proxy/http/services.odata.org/V3/Northwind/Northwind.svc");
// oData.oHeaders = {
// "DataServiceVersion" : "1.0"http://services.odata.org/V3/Northwind/Northwind.svc
// }; //debugger; oMainView.setModel(oData,"data");
// return oMainView;
};Code in Component.JS File
But i am unable to consume my the services. While debugging my application in Chrome i am getting below screen.