on 08-03-2014 2:11 PM
Hi all,
I've tried to create the Best Practices Demo as described in https://sapui5.hana.ondemand.com/sdk/#docs/guide/170638b7a2b4424e8580fb473af6a3cd.html in the Developer Guide. However, the code snippet
config : {
resourceBundle : "i18n/messageBundle.properties",
serviceConfig : {
name : "Northwind",
serviceUrl : "/uilib-sample/proxy/http/services.odata.org/V2/(S(sapuidemotdg))/OData/OData.svc/"
}
},
expects /uilib-sample/proxy... to be a valid URL on Hana, but unfortunately, at least in our Hana, it is not. This should work as a proxy to odata.org because direct connection is no allowed due to CORS limitations. Where does /uilib-sample come from, is this some external package or is it part of NetWeaver or similar? Can the demo be constructed without it? Or is it possible to get it somewhere?
Cheers,
-- Micha
Hi Micha,
I had the same problem and found the solution for getting this to work on your local machine. You have to make use of the "SimpleProxyServlet" you find in the web.xml. I'm assuming you're working with Eclipse to create the demo app...
In web.xml you have to add some code below the following part that's already there:
<servlet> | ||
<servlet-name>SimpleProxyServlet</servlet-name> | ||
<servlet-class>com.sap.ui5.proxy.SimpleProxyServlet</servlet-class> | ||
</servlet> | ||
<servlet-mapping> | ||
<servlet-name>SimpleProxyServlet</servlet-name> | ||
<url-pattern>/proxy/*</url-pattern> | ||
</servlet-mapping> |
Now just below you add the following lines:
<context-param> | ||
<param-name>com.sap.ui5.proxy.REMOTE_LOCATION</param-name> | ||
<param-value>http://services.odata.org:80</param-value> | ||
</context-param> |
I am not entirely sure what this does but I think this allows the app to connect to this remote server, because the proxyServlet only works for this url (I tried google.com but this redirects me instead)
Now in the Component.js you have to adapt the serviceUrl as well (you could write some conditional code if you want to run this on a Netweaver system too)
serviceConfig: {
name : "Northwind",
serviceUrl: "proxy/http/services.odata.org/V2/(S(sapuidemotdg))/OData/OData.svc/"
}
This did the trick for me. You can test this by invoking http://localhost:50085/DemoApp/proxy/http/services.odata.org in a browser (replace the port nr. by the port Eclipse is actually using)
I hope this helps!
Regards,
Gert
EDIT: If you're behind a proxy server it might not work and you've to adapt Eclipse's settings under General > Network Connections and add your proxy server config.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I also got stuck at this point in the Best Practices Demo.
Can anybody help please?
Regards,
Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.