on 05-06-2015 5:14 PM
Hi ,
I am trying to run one of the example which i saw in scn.During the execution i got following error .even after allowing allow-control-allow-origin in chrome
browser and Please help me how to overcome cross origin in devlopment envirornment at the same time in production envirornment.
XMLHttpRequest cannot load file:///C:/Users/Jagadeesh/Desktop/proxy/http/services.odata.org/Northwind/Northwind.svc/$metadata. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.o.defaultHttpClient.request @ sapui5.hana.ondemand.com/resources/sap/ui/thirdparty/datajs.js:17
my code for calling service
var sURI = "proxy/http/services.odata.org/Northwind/Northwind.svc/";
var oModel = new sap.ui.model.odata.ODataModel(sURI, true);
var oTileCont = new sap.m.TileContainer("tc",{});
//Tile Template
var oTileTmp = new sap.m.StandardTile({
icon : "sap-icon://menu",
title : "{CategoryName}",
info : "{Description}"
});
oTileCont.bindAggregation("tiles","/Categories",oTileTmp);
Hi,
Close all you chrome session and make sure none is running in task manager. And now using command prompt navigate to chrome location as below and enter below highligted command.
This will open a chrome window which will not give you that cross origin error.
C:\Program Files (x86)\Google\Chrome\Application>chrome.exe --disable-web-security
--Aakash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dheeram,
I got the following error. and please check my code to.
var sURI = "proxy/http/services.odata.org/Northwind/Northwind.svc/";
var oModel = new sap.ui.model.odata.ODataModel(sURI, true);
var oTileCont = new sap.m.TileContainer("tc",{});
var oTileTmp = new sap.m.StandardTile({
icon : "sap-icon://menu",
title : "{CategoryName}",
info : "{Description}"
});
oTileCont.bindAggregation("tiles","/Categories",oTileTmp);
var page = new sap.m.Page();
page.addContent(oTileCont);
var app = new sap.m.App();
app.addPage(page).setInitialPage(page.getId()).placeAt('body');
How are you launching/running your application. If its in eclipse, then you can run the application as a Web App Preview. For that you need to configure tomcat and restart the eclipse.
Select index.html and right click on it, Run As and select Web App Preview.
If possible can be you paste complete index.html code.
Thanks,
Dheeram
Hi Dheeram,Thank u for ur instant response,Please find code.I am just running like a html page.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>OData Tile Creation</title>
<script id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core-dbg.js"
type="text/javascript"
data-sap-ui-libs="sap.m, sap.me"
data-sap-ui-theme="sap_bluecrystal">
</script>
<script type="text/javascript">
var sURI = "proxy/http/services.odata.org/Northwind/Northwind.svc/";
var oModel = new sap.ui.model.odata.ODataModel(sURI, true);
var oTileCont = new sap.m.TileContainer("tc",{});
var oTileTmp = new sap.m.StandardTile({
icon : "sap-icon://menu",
title : "{CategoryName}",
info : "{Description}"
});
oTileCont.bindAggregation("tiles","/Categories",oTileTmp);
var page = new sap.m.Page();
page.addContent(oTileCont);
var app = new sap.m.App();
app.addPage(page).setInitialPage(page.getId()).placeAt('body');
</script>
</head>
<body class="sapUiBody" id="body" role="application">
</body>
</html>
Try to change the src to "https://sapui5.hana.ondemand.com/resources/sap-ui-core.js". You are using debug source one. And try to configure tomcat in eclipse and run as a Web App Preview.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why do you use "proxy" before the http url?
Have you already tried this: SOLVED: how to bypass Access-Control-Allow-Origin with javascript only? :: WP Questions ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.