I am getting this error
Get $ 40 metadata (not found)
My code for URL assignment is below
var sServiceUrl = getServiceUrl ("http://xx.yyy.net:8000/sap/opu/odata/SAP/ZXXX_SRV") ; Function getServiceUrl (sServiceUrl) {var sOrigin = window.location.protocol + "//" + window.location.hostname + (window.location.port? ":" + Window.location.port: ""); If (! JQuery.sap.startsWith (sServiceUrl, sOrigin)) {return "proxy" + sServiceUrl.replace (": //", "/"); } {Return sServiceUrl.substring (sOrigin.length)}}
Is there any idea what I'm missing
thanks
The user originally answered this question in two of his comments. However, I think the original poster (OP) and the general audience really need some background to understand the problem and the suggested solution. That's why I want to repeat this problem first and then I want to provide a solution.
Replacing the problem
The root cause of the problem is that the Javascript code is drawn by OP to their query, local web server, in this case http: / / Localhost: 8888
, and then it wants to call an ODATA service on the javascript code http: //xx.yyy. Net: 8000
In the background (using XMLHttpRequest-Object) it violates the same basic policy (SOP) applied by almost all browsers, which states that such background calls only protocol (HT), server ( Localhost) and port (8888).
A common solution for this problem should be a proxy inside the local server, which contains all requests for a particular form (in our case http: // localhost: 8888 / proxy / \ * < / Code>) at a remote address (in our case
http://xx.yy.net:8009/\*
).
Receives local server calls, and inside Proxy locals server (which is not under SOP) takes it forward for the Odata service. Everything looks fine for the browser.
Why does it run in Eclipse
SAP has provided such a proxy in the form of a Java servlet. This proxy can be used by Eclipse (built-in Jetty, or any other web server like Tomcat) in any Java based web server. OP was clearly able to run this eclipse web server and properly configure the proxy provided.
Why this node does not run in J.J.
Just node .js application is apparently not able to run the OP proxy instead of node.js server Some javascript proxy is required behind such a screen, during Goghil I found the first one but there are a lot more available.
No comments:
Post a Comment