Skip to Content

HTTP request failed after OData update() method


I have a strange issue - after I use update() method of the sap.ui.model.odata.ODataModel class, I can't make read() from the OData model.

I use Northwind OData service, V2.

I can do as much read() actions as I want - everything works fine.

But after I update() for the first time after the page is loaded and try to make read(), I get the following error:

GET https://webidetesting<appname here>-<account name here>…iexfh2tyudc5p4qhx5gdf))/OData/OData.svc/Products?$filter=(Rating%20eq%201) 500 (Internal Server Error)

HTTP Status 500 - HTTP protocol error occurred while connecting to remote host

When I reload the page and make read(), I can see that the update was successful.

Here is my update() method:

                merge: true,
                async: false,
                success: function(){  
                error: function(oError){  

Any ideas why this may happen?

Thank you.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Oct 22, 2015 at 07:37 PM

    well, service returns 500. it is not UI, it is service

    what is the difference in refresh which is working and the one which is not?

    Add comment
    10|10000 characters needed characters exceeded

    • Yes,

      I have the following lines in my prepareQuery() function (which reads values from fields and prepares filters for read() call):

      var oQueryResult = sap.ui.getCore().byId("idView1").getController().doQuery(sSourceTable, aFilter);
      sap.ui.getCore().byId("idView1").getController().getSelectedColumns(oQueryResult, sAction);

      If I use async: true, then oQueryResult object which is passed to getSelectedColumns() function is null.

      And if I put "return oData;" from the doQuery() function under success property's function (and not after read() call), oQueryResult object is undefined.

      Only when I set async: false, and only when "return oData;" is located after read() call I have all the results passed to other functions correctly.

      Maybe I'm missing something here; I'm still learning.

      But this "500 server error" issue is much more disturbing - it ruins my app.

  • Oct 31, 2015 at 10:57 AM

    I still can't get it work. No idea what is happening here...

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 04, 2015 at 11:06 AM

    Update: it seems like the problem arises when I try to do something with metadata.

    If after update() I try to refresh the metadata: sap.ui.getCore().getModel("odata").refreshMetadata();

    I get server error 500, but then I all my queries work fine without reloading the page.

    Add comment
    10|10000 characters needed characters exceeded