Hi All,
I'm having an issue connecting to Service URL from Eclipse environment.
Have gone through the forum and followed all possible tips provided by somehow I'm unable get the code to work.
Things I have done so far.
In Component.js file :-
Declaration part (metadata)...
config : { | |
resourceBundle : "i18n/messageBundle.properties", | |
serviceConfig : { | |
name : "Northwind", | |
serviceUrl : "/V2/(S(sapuidemotdg))/OData/OData.svc/" | |
} | |
}, |
and in the function init of Compoenent.js...
// Create and set domain model to the component | |
var sServiceUrl = getServiceUrl(mConfig.serviceConfig.serviceUrl); | |
function getServiceUrl(sServiceUrl) { | |
//for local testing prefix with proxy | |
//if you and your team use a special host name or IP like 127.0.0.1 for localhost please adapt the if statement below | |
if (window.location.hostname == "localhost") { | |
return "proxy" + sServiceUrl; | |
} else { | |
return sServiceUrl; | |
} | |
} | |
var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true); | |
this.setModel(oModel); |
Then...in web.xml...
<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>
<context-param>
<param-name>com.sap.ui5.proxy.REMOTE_LOCATION</param-name> | |
<param-value>http://services.odata.org:8080</param-value> |
</context-param>
Also... in the Eclipse Network Settings...
Have followed the steps mentioned in the below link...
Can someone please provide me if I have missed something or the way to bring it to life.
Warm Regards,
Sunny