Skip to Content

In this blog I want to gain your attention and give an introduction to an OpenSource project I recently started a few weeks ago on GitHub. The aim of the n-odata-server project is to develop an OData server that runs on node.js backend which helps us to develop better SAPUI5 applications in shorter time.

Motivation

Why don’t you use SAP Gateway?

You would obviously ask: Why do you want to implement your own OData server. There is SAP Gateway that fulfills this perfectly. My answer is “yes” and “no”. If you are working in a SAP environment and the backend functionality has already been developed you simply implement your OData service on SAP Gateway and can develop your SAPUI5 frontend against this middleware. But what if the backend is developed at the same time as the frontend and both parts should go live at the same time in near future?

Why don’t you use Mockserver?

You would say: “There is a very good mockserver” that you can leverage to develop your SAPUI5 frontend absolutely autarkic. Again the answer is “yes” and “no”. Of course the mockserver helps very much but there is one point that bothers me.

Mockserver cannot save data to files

The mockserver can read the data you defined in your local JSON files and you can then do most everything with this data in your SAPUI5 application (complete CRUD functionality). But if you refresh the page cause e.g. you changed a little bit in your source code all the data you entered so far is gone. The application / mockserver loads the data from your local JSON files and you have to do enter all your data again to test your code change. This is due to a javascript security policy. Javascript applications are not allowed to save data to the local file system and the mockserver has no chance to save the data to a backend system cause there is no appropriate service for this.

Developing app over a longer time

Or think about a scenario in which you develop your app over several weeks and because you also have other projects you only can spend 1 or 2 day a week on the UI5 project. In this case it would be really great if you could start with the data you entered the week before.

End-User Workshops

Another scenario is delivering of the frontend application for end-user workshops as early as possible even if your backend is still in an early development phase. If such a workshop lasts more than a few hours maybe some days the users expect that they find the data they entered the day before when they restart testing the next morning. With mockserver this is only possible if you tell your users not to shutdown the browser and the computer in the evening and not to refresh the page. But you know as me that this is ofter not possible or the end-users don’t listen to you or sometime you need to clear the browser cache.

Non-Gateway Scenarios

Last but not least there are scenarios in which you don’t have a SAP backend like R/3, S/4 Hana or HANA. In this case you have to implement your backend on your own. Of course you can simply implement a RESTful JSON api with java, node.js, php, … But as SAPUI5 developer you already know and appreciate the benefits of OData. As far my research revealed there are no out-of-the-box solutions yet even no lightweight ones that can also quickly be enabled for the above mentioned other scenarios.

Why node.js?

Next question you might ask is: “Why do you use node.js and not Java?”. I am an experience Java developer. So it would be no problem for me to leverage the Olingo library to implement an OData server with Java. But there are four reasons that lead me to node.js.

SAP commitment to node.js

Some weeks ago SAP officially commited to node.js. They will change the javascript engine of SAP HANA to node.js and they will support node.js on HCP (Hana Cloud Platform) when they roll-out the cloudfoundry support. With the cloudfoundry roll-out you will be able to develop not only Java or HANA backend application on HCP but also node.js applications.

I personally expect that javascript (node.js) will get much much more attention on backend side in the next years and will replace Java in many cases.

Server startup time

In the Java world most of us work with a Tomcat server. Even though it is lightweight compared to SAP Web AS Java or IBM Websphere or whatever, the startup takes some time. This is annoying for every developer. A simple node.js server starts in felt no time (milliseconds).

Node.js library to support several DB-systems

Then there is this great node.js library (called package in node terminology) called loopback that abstracts the db layer. This this library it is easily possible to support several DBs like Oracle, MySQL, Postgres, MongoDB, … It supports also a flat file database for apps with small data or testing screnerios.

State of the n-odata-server project

Cause I started the project a few weeks ago and I cannot work on it every day it currently is in quite early state. Therefore it supports only basic OData scenarios at the moment.

But because I decided to develop it as an OpenSource project I hope that a few other guys also see the potential of it an contribute to it. I’m not only looking for developers. Also testers, documentation writers of even marketing people with a huge business network are welcome.

Currently we are two developers who work on this part-time.

We collaborate via Slack and manage our task with Trello and have online meetings on Google Hangout from time to time. With these tools we are extremely agile and it should be no problem to collaborate even with participants from different continents.

The future of n-odata-server

As I’m at the beginning of the development there is still a lot of work. The first step at the roadmap would be to implement the minimal OData conformance level. Later I would like to implement the intermediate and advanced conformance levels.

Additionally I would like to implement a metadata importer that generates the loopback data model from an existing OData metadata file.

Also there is room for new ideas that might come by you.

Resources

Following is a list of resources I mentioned in this blog. These may help you to get a deeper insight in what I´m technically talking about.

This is the end of my short introduction to this project. I hope I could enthuse one, two or hundred people to contribute to the project.

See you on

To report this post you need to login first.

11 Comments

You must be Logged on to comment or reply to a post.

    1. Helmut Tammen Post author

      Thank you Frank for your response. So I seem to be on the right way.

      SAP is also developing a node.js odata server which they will roll out with HANA SPS 11. But this server does not seem to be OpenSource and it is closely stuck to HDB.

      (0) 
  1. RA Eijpe

    Great Initiative. I looking for a solution for some times and current implementations. I looked at Jaydata-server, an odata library on nodejs and MongoDB, but this didn’t fit and developments are stopped since 2014. I teaching OData for SAP Education since 2013, so if you need some help, please let me know.

    (0) 
    1. Helmut Tammen Post author

      Hi Robert,

      thank you for this great response. I ran into the same problems with Jaydata and other solutions too. They either were all in an early state and/or they only supported one single database (mongodb or mysql / postgresql). With loopback I’m very flexible and cause it’s a product from Strongloop (an IBM company) and seems to play an important rule in IBMs node.js strategy it will probably not die very soon.

      Currently the project supports basic functionality of OData V4. But cause SAPUI5 / OpenUI5 are still build on OData V2 I’m currently thinking about supporting V2 first and do V4 later. What do you think about it? Will SAPUI5 come with V4 support soon?

      Best regards

      Helmut

      (0) 
      1. RA Eijpe

        Looking at the UI5 ODataModel source SAP UI5 supports OData version V2 and V3.

        I know that SAP is implementing a subset of OData V4 in the current NetWeaver Gateway. After the release this new Gateway version, properly SAP UI5 will also supports V4. But I think the first release will be mid 2016.

        I believe supporting OData V2 is a good idea. In a second step you can add the SAP annotations and then go to OData V4.

        SAP annotations will become very important for SAP, because these will be the bases for SAP Smart Controls and SMART Templates.

        (0) 
  2. Martin Zaman

    Hi Helmut,

    thanks for this great package!

    I tried it by myself, created an n-odata-server and generated a fiori app on hcp.

    My usecase is to get json from rest-service, write it to the loopback models and produce the oData with n-odata-server. Im struggling with the refreshment of odata…

    Anyway, I noticed that only SAP UI5 1.26 (deprecated) is supported. Are you planning to support newer versions too?

    (0) 
  3. Helmut Tammen Post author

    Hi Martin,

    thank you for your comment. I do not only support UI5 1.26. I personally use it with 1.38 at the moment.

    I don’t understand you problem. Is it related to n-odata-server or loopback. In latter case I encourage you to read the loopback documentation.

    Regards Helmut

    P.S.: If you have problems with n-odata-server or find errors please raise an issue at github.

    (0) 
  4. J. Jansen

    Hi Helmut,

    Great initiative. At what stage is the project with regards to the oData conformance level? As you know, most UI controls like lists automatically produce oData calls with parameters like $top, $skip etc. Being able to support a simple application, would at least require intermediate conformance level for the oData mockserver.

    Kind regards,

    Jeroen

    (0) 
    1. Helmut Tammen Post author

      Hi Jeroen,

      some others and I already use the n-odata-server with UI5 applications also for little productive applications.

      I usually start with a Web IDE template and then enhance the app. This works very well. n-odata-server supports nearly all of the standard OData V2 URLs and parameters. Just not all filters are implemented yet and if it comes to deep navigation we have some work too. If you need Function Imports you have to implement them manually. There is no special support for it or a template that you could use.

      For the next release I also implemented security so that you can assign ACLs to the service.

      Before I started the project I had a look at several other node.js OData servers but they were either hard linked to a specific database and/or the OData specification was implemented very basically. The goal of n-odata-server is to support nearly the complete OData spec for V2 and later for V4.

      If you use my product and find an issue please use the github issues for reporting it or fork the project, fix an issue and send a pull request 😀 .

      Regards Helmut

      (0) 
  5. Jean Guo

    Cool project! I have started my odata service successfully by your step-by-step tutorial. But seems the service interface is not exactly working well with sap.ui.model.odata.v2.ODataModel. According to comments to the blogger, it should work.Do you have sample of ODataModel consuming odata service provided by n-odata-server? Say like a simple List Control + v2.ODataModel + odata service. Many thanks in advance.

    (0) 

Leave a Reply