Skip to Content
Author's profile photo Denise Nepraunig

Accessing HANA XS OData in Web IDE and beyond

THIS BLOG POST IS FROM 2015 where there were some issues in the SAP Cloud Platform TRIAL edition. Everything works now like a charm!

And just to be clear: everything which involved on-premise SAP HANA + Cloud Connector always worked!!!

Hello everybody,

here I’d like to share what I have learned while trying to access a HANA XS OData service in our SAP Web IDE (cloud) trial edition. I’ve have been asked by several people if it is possible – and the answer is: it depends.

You could also access the services with a node.js solution by Gregor Wolf!

With this blog post I don’t want to start a discussion about “why is it not possible under certain circumstances?” – because there are lots of technical internal details involved. I’ve talked with a bunch of people and addressed the actual circumstances there.

Here I just want to highlight what you can do TODAY to give it a try. This is not a detailed step by step tutorial here, I just give you hints what you can do with certain examples, because the whole HCP/HANA topic is quite big and there are a lot of resources out there:

 

So if you have any questions concerning the HANA (privileges, shine app, sflight…) / HCP (destinations…) topics highlighted here in this blog post I’d kindly ask you to go to the corresponding SNC spaces for HANA and HCP or have a look into the openSAP courses to learn more.

If you are new to the SAP Web IDE visit our SCN space with lots of tutorials.

SAP Web IDE and SAP HANA Trial: not yet

I’ve been in discussions with Eduard Bartsch and Martin Raepple about this topic and currently it is not possible to consume the HANA XS OData services via the HCP cloud destinations in our SAP Web IDE.

It also has been asked if you could change the settings in the of the .xsaccess file to Basic or anonymous -> no it is not possible, these settings are ignored, SAML2 only.

So this means this setup is not possible yet:

/wp-content/uploads/2015/01/hanatrial_623340.png

SAP Web IDE and SAP HANA via SAP CAL: yes

Last week I got great help from Craig Cmehil in setting up my SAP HANA system via the SAP CAL (Cloud Appliance Library) – this is basically a system hosted on AWS where you just pay for the time the machine is running. The AWS setup is also used in the openSAP courses at the beginning – later they are also using the SAP HANA Web based development environment. SAP CAL is just an super easy user interface for controlling your AWS machine.

Here is the info about the AWS with the “Getting started guide” and here is the info about the included SAP HANA.

I have used the SFlight service and used the Basic Authentication which was available by default with my database user. Here the destination settings in the HCP cockpit – the URL points to the IP-address of my AWS machine:

/wp-content/uploads/2015/01/sflight_623341.png

Working in SAP Web IDE with SAP HANA by SAP CAL:

hana_flight_running.PNG

Mock in SAP Web IDE and “importing” into SAP HANA trial Web IDE: yes

This is maybe not the most elegant solution, but you can leverage our SAP Web IDE for creating the SAPUI5 application with our SAP Fiori template, code completion, … and use the mock data service to preview the app without the working connection. After that you could put this app into your SAP HANA trial account, make some adaptions and continue the development there.

For this I’ve used the sample SHINE application from SAP:

/wp-content/uploads/2015/01/poworklist_623349.png

I executed the service and saved the response from $metadata as metadata.xml:

/wp-content/uploads/2015/01/metadata_623350.png

In the SAP Web IDE I created a project based on the SAP Fiori Starter Applications and uploaded the metadata.xml from my local pc:

/wp-content/uploads/2015/01/metadataxml_in_webide_623351.png

To test the application you have to run it with mock data:

/wp-content/uploads/2015/01/run_with_mock_data_623352.png

Mocked data:

/wp-content/uploads/2015/01/mocked_data_623353.png

After that I have downloaded the project as zip (and then unpacked it):

/wp-content/uploads/2015/01/export_project_623354.png

Then I switched over to the SAP HANA Web IDE:

/wp-content/uploads/2015/01/launch_hana_web_ide_623355.png

In my shine application I created the corresponding packages and drag & dropped the files in the corresponding packages (no dragging of folders possible and no automatic zip-extraction possible yet):

/wp-content/uploads/2015/01/packages_web_ide_623356.png

Here are the additional steps I had to do:

index.html

I had to change the location of the sapui-core.js:

<script id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"

The one provided from the shine application (/sap/ui5/1/resources/sap-ui-core.js) had problems with the Icon Tab Bar.

Component.js

I had to reference the location of the XS service:

var sServiceUrl = "../../services/poWorklist.xsodata/";

Additional pitfalls

During development sometimes I had to run the application again so that the source was updated:

/wp-content/uploads/2015/01/run_on_server_623363.png

And sometimes I even had to clear the cache:

/wp-content/uploads/2015/01/empty_cache_623364.png

Here the final running XS application:

/wp-content/uploads/2015/01/hana_xs_running_623365.png

Maybe the steps with the file replacement are easier within your local Eclipse and the HANA tools connected to your trial cloud system, I haven’t tried it out yet – I must continue with my openSAP course 😉 I will update this section after that.

HANA XS trial and beyond <<update>>

SAP Mentor Gregor Wolf also played around with the SAP HANA trial XS services and came up with a node.js solution which he hosts here on github.

Update 15th January 2015

With the combined power of a blogging SAP developer girl, a hands-on SAP Mentor and a knowledge spreading SAP employee (HANA Academy) – we could fix an issue in the setup wich led to the final solution:

  • node.js SAML2 app by Gregor on your computer
  • + with running SAP HANA cloud connector on your computer
  • => which is then maintained in the HCP destinations
  • => and then consumed in the SAP Web IDE
  • => based on this you can create and deploy an HTML5/SAPUI5 app
  • = awesome stuff!!!

Here is a rough sketch which tries to illustrate this solution – I tried my best – I am a developer and not architect 😉

Bildschirmfoto 2015-01-15 um 22.51.38.png

>>> The solution is described here at theclosed github issue. Thank you very much Gregor for your great support! That’s how communities work! YEAH!!! <<<

TL;DR

  • HANA trial consuming in SAP Web IDE via HCP destination service: not yet
    .xsaccess settings could not be set to Basic or anonymous -> service is always SAML2 based due to trial restrictions
  • HANA productive or HANA on AWS through SAP CAL via HCP destination service consuming in SAP Web IDE: yes –> AWS link
    (I’ve seen also CORS settings in the XS seetings so maybe this is even possible without HCP destination service)
  • Mocking in SAP Web IDE and “importing” into SAP HANA Web IDE: yes
  • Accessing service via node.js with Cloud connector and destinations in SAP Web IDE: yes

Summary

I hope I could have given you some hints on how you can consume the SAP HANA XS services in the SAP Web IDE or even with node.js – thanks to Gregor Wolf. If you are taking the openSAP about software development on SAP HANA you would probably already have your AWS machine up and running. The SAP HANA trial is at the moment ( ! )  from my understanding an isolated system where you can develop your XS applications, but you normally can not consume the services from the outside or via the HCP destination service (without destination service you could not consume them in your browser because they are not CORS enabled).

Assigned Tags

      35 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Tamas Szirtes
      Tamas Szirtes

      Thx, Denise, for this clear status report and recommendations. Some of us have struggled with these points for some time, from now on, people can just read it all here. Really useful!

      Regards,

      Tamas

      Author's profile photo HP Seitz
      HP Seitz

      Good enlightenment on the SAP zoo. Great Information, please keep us in the loop.

      Thx in advance, HP

      Author's profile photo Robert Eijpe
      Robert Eijpe

      Hi Denise,

      Great blog

      Regards

      Robert

      Author's profile photo Gregor Wolf
      Gregor Wolf

      To allow secure usage of my HANA Trial Auth Proxy I've added HTTPS support today.

      Author's profile photo Rahul Aware
      Rahul Aware

      Amazing complexities for a newbie.

      I am trying to create a simple UI5 based mobile app that can directly consume XS oData service hosted on HANA trial instance.

      Have hit the authentication roadblock. 🙁

      One quick question about the node.js based proxy for authentication. For hybrid mobile app (UI5 + cordova) scenario - will it work? Can the proxy be generated on mobile device?

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hello Rahul,

      please note that this authentication issue does only exist on the HCP trial (which is free for developers). I think including the proxy inside the app is not the right approach as in a hybrid app when you also want to use the HCP Mobile Service. If you want to be independent from your local computer then setup the hanatrial-auth-proxy on a system in the cloud with HTTPS.

      Best regards

      Gregor

      Author's profile photo Trond Stroemme
      Trond Stroemme

      Hi Gregor,

      can you confirm that this solution should only be necessary in the trial HCP account scenario? I'm trying to do this (connect Web IDE to HCP xsodata services) within a productive HCP environment, but getting blocked. Not sure why; still playing around with setting up destinations correctly. Any confirmation that this should work out of the box on a non-trial system would be nice.

      Regards,

      Trond

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hi Trond,

      there are reports that using HANA .XSODATA Services in HCP Production without my "Hack". But you have to check if the authentication methods offered for the Web IDE destinations match the authentication that is set-up for HANA. Hope someone from SAP can give guidance here.

      Best regards

      Gregor

      Author's profile photo Denise Nepraunig
      Denise Nepraunig
      Blog Post Author

      Hello Trond,

      you see in my blog, that I have used the SAP CAL also, this is not a "trial" machine, it is a real HANA with a free developer licence. I have used my in the Web IDE, in the destination screenshot you see, that I've used the SYSTEM user of the HANA and the additional parameters like WebIDEEnabled and so on. I have used Basic Auth.

      I guess I have checked via the xsadmin and enabled Basic Authentication, because I did not want to work with certificates/SAML and so on. For those authentication questions please open a question in the dedicated HCP/HANA SCN spaces, Martin Raepple is active in HCP and has a lot of security know how.

      Author's profile photo Trond Stroemme
      Trond Stroemme

      Hi Denise, thanks for the info. I'm not using AWS but a dedicated HCP for my company. We're doing first steps here 🙂

      Did you use port 443 in the URL to your AWS system? I see from the documentation in HCP itself that this seems to be the "preferred" port for Internet connections.

      If still not working, I will get in touch with Martin to get this resolved. We have a complex setup with proxies and firewalls so there might be some other obstacles I don't know about. I'm not a security/network guy - couldn't even explain "SAML" if I wanted to...

      Regards,

      Trond

      Author's profile photo Trond Stroemme
      Trond Stroemme

      Hi again,

      you were right. We had to set the Basic Authentication in the XS Admin console... of course I did not have access to do this since this is not my private system, but with some help we managed to do this as a workaround. Thanks for the input!!

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hi Trond,

      perhaps you could post the required steps in a Blog. Seems that some community documentation could be needed here.

      Best regards

      Gregor

      Author's profile photo Trond Stroemme
      Trond Stroemme

      Hi Gregor,

      happy to do this. Our working solution is not the "industrialized" one we will use for the future, but it works for now. Ideally we would use some kind of SSO authentication to avoid using a named user/pwd in BasicAuthentication, but I'll write up the steps we followed and post it as a blog. Guess I can then follow up later when the final solution is established.

      Regards,

      Trond

      Author's profile photo Marcus Conrad Behrens
      Marcus Conrad Behrens

      I hacked together something similar (also with Martin Raepple's help) available here: Measure the Sun with Hana Cloud Platform – Hands On Tutorial

      It ties together the Java and the XS side on the same XS database schema with authentication either via OAuth (java side) or Basic (XS Side for analysis) - all in the trial account and all from the comfort of your browser (no eclipse or other servers required).

      Would love to see how the Web IDE could be used for Hana development in trial accounts.

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Dear Marcus,

      I'm still quite sure that the HCP Trial XS Engine is only accessible via SAML authentication. Perhaps Martin Raepple has new information. So you still have to use my Project https://github.com/gregorwolf/hanatrial-auth-proxy which I've just updated yesterday to support also Corporate Proxy Servers (currently without authentication to the proxy server).

      Best regards

      Gregor

      Author's profile photo Former Member
      Former Member

      Hi Gregor,

      I am stuck in the middle.

      I have installed the node.js server and started.

      I have installed the cloud connector and connected the HCP trial account.

      Now I don't understand what would be the next step?. Can you please explain me the next step?

      Regards,

      Rajesh

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hi Rajesh,

      you configure the Cloud Connector to point to the node.js server. Make sure you can reach our service locally first. Then define a destination in the HCP Cockpit pointing to your Cloud Connector. Please send a pull request for the gregorwolf/hanatrial-auth-proxy · GitHub project when you like to have more instructions on the readme.md.

      Best regards

      Gregor

      Author's profile photo Former Member
      Former Member

      Hi Gregor,

      I got it worked 🙂 .

      Appreciate your great work and solution.

      Now I am trying to do little different. I think you could help me.

      I am trying to do reverse proxy for the xsodata of the Production Hana HCP to my local Apache.

      Below is my reverse proxy code(authenticated via SSO)

      ProxyPass /myapp https://production.hana.ondemand.com/mypackage/stud.xsodata

      ProxyPassReverse /myapp https://production.hana.ondemand.com/mypackage/stud.xsodata

      ProxyPassReverseCookiePath https://accounts.sap.com /myapp

      ----

      The xsodata is configured for SAML authentication

      When I enter http://local/myapp in my local browser..

      it got authenticated via accounts.sap.com then it end up in error like this

      /wp-content/uploads/2015/08/reverse_761123.png

      it is working for Basic authentication but not SAML authentication.

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hi Rajesh,

      as cookies are set on a domain level you will have issues with your domain local. Perhaps you could try setting up local.ondemand.com pointing to 127.0.0.1 in your local hosts and give it another try. If you can identify that it is an issue with gregorwolf/hanatrial-auth-proxy · GitHub please post an issue there to not clutter up the comments here further.

      Best regards

      Gregor

      Author's profile photo Former Member
      Former Member

      Hello Gregor Wolf

      Nice job! I discovered your solution testing the demo "Live3 - SAP HANA Cloud Platform for Advanced Real-Time Social Media Analytics", from SAP HANA Academy.

      I have some trouble with proxies and could finally test the solution inside SAP using a different network. However, sometimes it works, but most of the time I get the following message in the nodejs app, when requesting the data:

      "Response is undefined

      problem with request: read ECONNRESET"

      So I wonder if it might be the network, or some problem in the HANA trial server, or any other problem with the configuration. Do you have any idea that could help?

      Best Regards

      Luis Becker

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Hi Luis,

      I hope you've seen also the tips posted by Maximilian Lenkeit at HTTP(S) Proxy support · Issue #2. I haven't run into this problem until now. Perhaps you can test at home with an unfiltered connection. If you still face issues please post it in the GitHub Project Issue tracker.

      Best regards

      Gregor

      Author's profile photo Ankit Gupta
      Ankit Gupta

      Hello Denise,

      Thanks for consolidating all the important information.

      Do you know if oData service is working now with HCP trial instance or still this is a challenge ?

      Regards,

      Ankit Gupta

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Dear Ankit,

      still now change on the SAML authentication requirement. So please still use my authentication proxy project. Open an issue at GitHub if you face any problem.

      Best regards

      Gregor

      Author's profile photo Former Member
      Former Member

      Hi Denise/ Gregor,

      I would like to consume OData services from native HANA XS system in my trial SAP Web IDE. Reading through the blog it seems it was not possible when it was written. Is it possible to do so now? I have HANA XS system in cloud connector and have added it as a destination in wed ide. Still now able to call OData services. My goal was to develop UI in Web IDE and consume OData services from native HANA XS system.

      Thanks,

      Mukul

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Dear Mukul,

      unfortunately until now nothing has changed. You still have to use my GitHub project. Hope you have no issues to set it up.

      Best regards

      Gregor

      Author's profile photo Former Member
      Former Member

      Hi Gregor,

      As I understood - code is for accessing HanaXS on hanatrial.ondemand.com. I have a native Hana XS engine that is accessible using VPN. I normally access it using http://<IP address>:8000 after logging into VPN.

      I looked at your Github code in 3 files config.js, server-basic-auth.js, saml-client.js. I replaced host name with native HANA system <IP address>:<port> in 3 files. Followed the instructions as you indicated in Github

      • Install node.js from http://nodejs.org/
      • Clone this repository and run npm install in the root folder
      • Start the proxy server using node examples/server-basic-auth.js

      After the port is opened - it gives error message "Connection refused" Connection timeout

      I am sure there are other sections where I need to make change. Can you please explain to me the steps to follow or point me to link where you have already discussed it?

      Also it wasn't very clear on what kind of configuration I need to maintain in Hana cloud connector. Would internal host be http://local host and internal port be 7891 now?

      Let me know if this is not the right place to raise this issue.

      Thanks,

      Mukul

      Author's profile photo Gregor Wolf
      Gregor Wolf

      Dear Mukul,

      my GitHub project is exclusively to fix the authentication issue with the HANA instances on HCP Trial. If you have an on premise HANA system then the HANA Cloud Connector is the right thing. But before you setup the Cloud Connector please talk to your security officer if that is allowed.

      Best regards

      Gregor

      Author's profile photo Trond Stroemme
      Trond Stroemme

      SAP has announced that the backend browser tools (for modelling etc) and the Web IDE (for Fiori/UI5) will finally merge into one holistic IDE, some time in the mid/near future).

      Of course, this makes complete sense and will greatly will facilitate things. Instead of being forced to use (cloud-based) HCP for UI5 development, you will be developing your frontend components (Fiori/UI5)on the same XS (Advanced) server as your backend components (business logic) reside - basically doing "holistic" development the same way we are doing it today in the Netweaver/ABAP world.

      Also, if you have (as we have) umpteen HANA tracks, there will be no need to create all those umpteen destinations from HCP back into each HANA system, whether you plan to finally deploy there or just consume services.

      I guess this is part of the reason why SAP is not moving too fast on this issue.

      Regards,

      Trond

      Author's profile photo Former Member
      Former Member

      Hi Trond,

      Thanks for your response. It can be looked at from 2 perspectives:

      All in one development environment - I agree, there is a need for a tool on HANA XS side that allows holistic development right from modelling, creating OData services to developing UI. At the moment we have it split between Web IDE for UI and XS IDE for modeling and OData services.

      Different UI and Data environment - Other side of the argument could be to keep the two units separate and build easy integration features between data and UI world. I think SAP is trying to pursue this strategy at the moment though not sure how long they would pursue it. Also integration features are quite in-adequate at the moment.

      Regarding your point on multiple HANA tracks - no need to create them as destinations in HCP? I didn't quite follow it. How do you propose consuming or deploying if you were to use Web IDE? Are you suggesting we should use any other workaround?

      Thanks,

      Mukul

      Author's profile photo Jay Malla
      Jay Malla

      Thanks Denise for this nice article.  Since the article is almost two years old I was wondering if there have been changes to the approach.

      I have a few questions for you:

      For the section - "SAP Web IDE and SAP HANA Trial: not yet"  - you have a comment in the article - "currently it is not possible to consume the HANA XS OData services via the HCP cloud destinations in our SAP Web IDE."  Since it's a while this article was written, is this still the case?

      I will try out the steps in section "Mock in SAP Web IDE and “importing” into SAP HANA trial Web IDE: yes.  Looks like this work around will do the trick without having to go through the node.js approach on the local machine.

      Your feedback is appreciated.

      Thanks,

      Jay

       

      Author's profile photo Former Member
      Former Member

      Hello Jay,

      I'm facing the same problem and unable to consume xsodata with my sapui5 application. did you solve your problem? and can you share your solution. I'm stuck right now ..

      Author's profile photo Jay Malla
      Jay Malla

      Hi Nafees,

      I did solve the issue.  Let me get that information to you.  Unless you have already solved this.  Sorry for the delayed response.

      Is your SAPUI5 app on the WebIDE?  Is your XSODATA for the MDC trial instance?

      Regards,

      Jay

      Author's profile photo Edgar Peña
      Edgar Peña

      Hello, Jay, regardless of the lack of response from Nafees, could you please give us light on how to connect from sapui5 applitacion to xsodata?

       

      Regards.

      Author's profile photo Jay Malla
      Jay Malla

      Is your database on the MDC trial?

      Author's profile photo Edgar Peña
      Edgar Peña

      Yes, trial, but I'm preparing to implement on paid account of a client. Is there still a problem to make such a connection on trial accounts? If so, can you please confirm if the problem occurrs on paid accounts too?