Skip to Content
avatar image
Former Member

Error while accessing ODATA Service from a SAP UI 5 Application

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/CATALOGSERVICE/$metadata?sap-statistics=true 500 (Internal Server Error)

I referred this blog   Creating a SAPUI5 starter application with the Gateway Eclipse plugin

Kindly provide some inputs to solve this issue.

Regards

Saravana

connectivity.jpg (126.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Dec 25, 2014 at 01:17 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Dec 29, 2014 at 05:06 AM

    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

    Add comment
    10|10000 characters needed characters exceeded