Skip to Content
avatar image
Former Member

Calling Apache Olingo based Odata V4 service with UI5 failed

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
             });
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

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


    Add comment
    10|10000 characters needed characters exceeded