Question

I was learning SAPUI5 in this week and I realized that even a web developer can write an enterprise mobile application using SAPUI5.

But I am confusing with data handling with server. Will the SAPUI5 app communicate only with an SAP-based application using OData?

Or can I communicate with a RESTful PHP-server app using HTTP methods?

Was it helpful?

Solution 2

Inside any UI5 app you can use the jquery ajax very easily.

$.ajax({
      type: "POST",
      data: "POST CONTENT DATA"
      crossDomain: true,
      url: http://mydomain.coim/service/endpooint,
      headers: {'key1':'value1','key2':'value2'}
      contentType: "application/json",
      success: function (res, status, xhr) {
            //success code
      },
      error: function (jqXHR, textStatus, errorThrown) {
        console.log("Got an error response: " + textStatus + errorThrown);
      }
    });

OTHER TIPS

OData is not a SAP-only protocol. OData is an Open Data Protocol: OData Website.

Also SAPUI5 have JSON-models you are able to use for RESTful GET-data. But in this case, all methods other then GET you have to do on your own.

You can try to implement OData in your PHP-application: OData Producer Library for PHP V1.2.

Yes, you can use RESTful API because sapui5 or openui5 is consist web technologies and it execute in browser. I have recently developed cordova-based mobile application using sapui5 and frontend webtechnologies(client side).

While producing and consuming pure RESTful endpoints is possible, you may consider renovating your solution landscape to product and consume OData as part of a mid to long term project to reduce or eliminate some technical debt.

By service enabling your systems, you can create an abstraction layer between the model/controllers and the views. This recipe allows for more robust applications while make the solutions less fragile with regards to maintenance and evolutions.

OData is a good mid to long term choice for service enabling solutions. OData has many advantages over purr RESTful endpoints with many verbs to perform the basic Create, Read, Update, Delete (CRUD) operations. There are also some nifty enhancements in version 4 to support more efficient batch processing (less chatty apps), annotations to support smart controls, etc.

There are some solutions available for you to add OData CRUD operations to databases as a use case for a legacy two tier application. Checkout the WSO2 Enterprise Integrator for off the shelf, or Apache Olingo if you want to roll your own.

I have refactored many legacy landscapes as a first step to major renovations towards more modern, standardized recipes. The process to service enable forces you to look at solutions at a process level and to extract the services/micro services that are executing. This will give you a better picture of what the solution does, what roles depend on the solution and how the solution compares to other solutions in the enterprise to identify candidates for absorption into other systems.

If your Backend does not support OData. The best alternative is a JSONModel (JSONModel) using the loadData(sURL, oParameters?, bAsync?, sType?, bMerge?, bCache?, mHeaders?) : void function. Make sure you use attachRequestCompleted(oData?, fnFunction, oListener?) : sap.ui.model.Model eventhandler before you fire loadData.

SAP UI5 app can communicate any application using OData or RESTful API's. End of the day it depends on how one has implemented the APIs and how are they consumed.

Yes, you can use any kind restful APIs which are exposed using HTTP methods.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top