Skip to Content

Calling Apache Olingo based Odata V4 service with UI5 failed

Dec 06, 2016 at 10:36 PM


avatar image
Former Member


I implement a Odata V4 service with Apache Olingo V4.0.

When I call this service with the read method of an ODataModel in UI5. I get an answer and no error but the oData Object in the success funktion is empty (undefined).

Only the respone.body is filled with the response :

{"@odata.context":"$metadata#Categories","value":[{"ID":1,"Name":"Notebook Basic 15","Description":"Notebook Basic, 1.7GHz - 15 XGA - 1024MB DDR2 SDRAM - 40GB"},{"ID":2,"Name":"1UMTS PDA","Description":"Ultrafast 3G UMTS/HSDPA Pocket PC, supports GSM network"},{"ID":3,"Name":"Ergo Screen","Description":"17 Optimum Resolution 1024 x 768 @ 85Hz, resolution 1280 x 960"}]}

Is it a problem that the @odata.context is only $metadata#Categories and not http://localhost:8080/odata/$metadata#Categories

var oModel = new sap.ui.model.odata.ODataModel("/odata",true);  
               filters : null,
               async : false,
               success : function(oData, response) {
                 var x = oData;
                 var y = response;
               failed : null
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Jens Ittel
Jan 20, 2017 at 04:29 PM

The deprecated sap.ui.model.odata.ODataModel and the recommended sap.ui.model.odata.v2.ODataModel support OData V2 services only.

For OData V4 services use sap.ui.model.odata.v4.ODataModel. See e.g. OData V4 Model on SAPUI5 SDK (always refers to the latest release) for more information on the usage and existing restrictions (check in the documentation for your release).

10 |10000 characters needed characters left characters exceeded