cancel
Showing results for 
Search instead for 
Did you mean: 

Error while accessing ODATA Service from a SAP UI 5 Application

Former Member
0 Kudos

Hi Experts,

I'm a beginner in SAP UI 5 application development , I tried to consume a ODATA service from SAP Netweaver Gateway demo system (https://sapes1.sapdevcenter.com:443/sap/opu/odata/iwfnd/CATALOGSERVICE/).

My Connectivity.js file looks as below

I'm getting the below error while running the application .

GET http://localhost:8080/CatalogAPP/proxy/http/sapes1.sapdevcenter.com/sap/opu/odata/iwfnd/CATALOGSERVI... 500 (Internal Server Error)

I referred this blog  

Kindly provide some inputs to solve this issue.

Regards

Saravana

Accepted Solutions (0)

Answers (2)

Answers (2)

romit_raina
Active Participant
0 Kudos

Hello Saravana ,

Need to do proxy setting , please follow the below steps :

1. Goto WebContent folder than to WEB-INF , please open the file web.xml (in Eclipse)

2. In the above file , change the proxy setting.

  <!-- ============================================================== -->

  <!--                                          UI5 proxy servlet                                              -->

  <!-- ============================================================== -->

  <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://sapes1.sapdevcentre.com:443</param-value>  

  </context-param>

3. In your  connectivity.js get the url by using below code :

  function getUrl(sUrl) {

       if (sUrl == "")

            return sUrl;

  if (window.location.hostname == "localhost"

            || window.location.hostname == "put your computer name") {

            return "proxy" + sUrl;

            } else {

                 return sUrl;

            }

  }

  var sURI = getUrl( '/sap/opu/odata/iwfnd/CATALOGSERVICE');

Kindly follow the above the steps and let me know of you still get any issue .

Thanks

Romit Raina

Former Member
0 Kudos

Hi,

Run the same URL in gateway system and check whether the service metadata is being executed successfully there or not. There might be some error in OData service or in system connections.

Regards,

Aashika

Former Member
0 Kudos

HI Aashika,

Thanks for your response !!

I tried accessing the ODATA service URL from browser , i'm able to fetch the metadata of the ODATA service.

But it doesn't work while accessing from UI 5 application

Regards

Saravana