Skip to Content

HCP Trial - Consume ODATA Services in HTML5 APP - How to configure DESTINATIONS

I am trying to develop a application using SAP HANA CLOUD PLATFORM TRIAL + ODATA + WEB IDE. I am not using SAPUI5, I am using AngularJs.

The table are exposed through OData services and its unit test is working fine, I get the result when executing it on the browser but I am facing a problem to consume this services in the HTML5 application.

I asked the experts on twitter and they ensure that is possible to consume my own the OData services using HCP TRIAL. I could consume for example third party Odata services, like NorthWind sample.

I would like to know what are the destinations configurations? Which URL I have to use? And which port? What about the authentications? Please could you please drive me on this kind of configuration?

I have searched for some topics but could not find anything that would solve my problem.

Most answers tells that is not possible to consume Odata Services in HTML5 in the TRIAL.

many thanks,

Filipe

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Dec 06, 2016 at 06:54 PM

    It is working!! Below are the Destination config, the HTML5 code and other configs.

    DESTINATION

    HTTP REQUEST (ANGULARJS)

    $http({
      method: 'GET',
      url: '/destinations/mydest/gardeniot/service.xsodata/Alert/?$format=json'
    }).then(function successCallback(response) {
    console.log("entrou aqui");
      console.log(response.data.d.results);
      }, function errorCallback(response) {
    console.log(response.data.d.results);
      });

    RESULT

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 05, 2016 at 06:29 PM

    Hi Filipe,

    Sorry to hear you are having troubles with your application. For clarity sake, can you please elaborate a little bit more on the specifics of your setup?

    You have created a Table, is this Table on your own machine, is it on an HCP Trial DB? If so, Is it a HANA DB? MaxDB? If not, where is it?

    You are exposing OData, how are you doing this? Are you exposing a HANA DB Table via XSOData? Have you built an OData service into a system? Are you using OData Provisioning?

    You are building an application in WebIDE but using Angular JS?

    Thanks,
    Elijah

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Filipe,

      Thank you for sharing your setup. As I suspected you are using HANADB via XSOData, and trying to consume in a UI5 App.

      There used to be an issue around HANAXS being 'isolated' from the main HCP area, and requiring a Proxy via HCC to bridge the gap, as outlined here: https://blogs.sap.com/2015/03/18/how-to-consume-a-hana-xs-datasource-on-the-hana-trial-landscape/

      I believe with the introduction of the MDC DBs this has been resolved however. If this is the case, then the easiest thing to do should be to simply add a destination pointing to the service. Then you can consume it directly in your HCP UI5 app by pointing to the destination.

      In doing some research for my reply unfortunately I discovered how out of date my knowledge is since the MDC changes. Previously all the the tricks I used were developed as workarounds prior to the solution MDC provides. This should make things simpler, but if you still struggle, can poke a UI5 expert to ask them to weigh in.

  • Dec 05, 2016 at 07:32 PM

    Hi Elijah, thanks for the answer! Below are the details related to my question.

    I am using HCP trial and a created a HANADB as follows:

    Using this DATABASE I created a few tables. In order to be able to consume that data I created a ODATA service by creating a file *.XSODATA with the below format:

    service {    "acme.com.odata::myTable" as "myTable";}

    After creating this Odata service I was able to test it by running this file:

    Below is the result after 'running' the service:

    Now I need to know how to consume this service in my HTML5 application. Do I have to create a destination for this service? What are the parameters I have to use? For URL and PORT? For authentication? Do I have to add any route in neo-app.json file after creating the destination? Which URL I have to call to perform a POST or GET request in my APP?

    Let mw know if you guys need further information about my doubts.

    Regards,

    Filipe

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 20, 2017 at 12:34 AM

    Hi Filipe - Did you get this working? I am having the same issues. I have created my data model in the HANA MDC Trial and created xsodata services. I can bring this up in a browser and navigate through the OData model. The problem is when I define this in my destinations, I am not able to invoke the service in my SAPUI5 application when pointing to the destination. I do see other older threads about setting up a proxy - but I am not sure if that still needs to be done since those might be for the older systems.

    Please do let me know. What type of authentication did you use. I tried Basic authentication and used the new database user - and the test connection works. But when I try to launch the SAPUI5 template application and point to the destination, then it is not working.

    It would be good to see if and how you solved this.

    Thanks,

    Jay

    Add comment
    10|10000 characters needed characters exceeded