cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Apache Olingo based Odata V4 service with UI5 failed

Former Member
0 Kudos

Hello,

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);  
oModel
         .read(
             "Categories",
             {
               filters : null,
               async : false,
               success : function(oData, response) {
                 var x = oData;
                 var y = response;
               },
               failed : null
             });

Accepted Solutions (0)

Answers (1)

Answers (1)

jensittel
Discoverer
0 Kudos

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).