on 10-22-2015 8:29 PM
Hello,
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>.dispatcher.hana.ondemand.com/nort…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 http://services.odata.org
When I reload the page and make read(), I can see that the update was successful.
Here is my update() method:
sap.ui.getCore().getModel("odata").update(
"/"+sSourceTable,
oUpdate,
{
merge: true,
async: false,
success: function(){
console.log("Success!");
},
error: function(oError){
console.log("Error!");
console.log(oError);
}
}
);
Any ideas why this may happen?
Thank you.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I try to figure out what is going on with server error after update method.
So, I want to locate where exactly the error comes from. Now I know that the error comes from metadata.
How did I get to refreshing metadata? Honestly, I got out of logical suggestions and started to do thing to see what will happen.
But it showed, that if I do that refresh, I get error, and after that I can do queries again.
I still can't get it work. No idea what is happening here...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The order is as follows:
1) I make update(),
2) I make update() or read() again,
3) the page is hung, it waints for reply from the server - it takes about 10-15 secs,
4) I get the errors
5) I refresh the page.
6) everything works again (until I run update() method).
No other delays, except the one in item 3.
Here are 2 errors of the read() right after the update():
GET<......>/OData/OData.svc/Products?$filter=(Rating%20eq%201) 500 (Internal Server Error)
HTTP Status 500 - HTTP protocol error occurred while connecting to remote host http://services.odata.org
Same errors I get from all next read() and update() methods until I refresh the page.
Nope, I just commented this line and ran the app.
The page still hangs.
Oh, and this issue is relevant for 2-way OData service.
I tried to update the same property at 1-way and, of course, I couldn't, but I still was able to read() after that unlucky update().
Here is my read() method (pretty much the same as update()):
sap.ui.getCore().getModel("odata").read(
"/"+sSourceTable,
{
async: false,
filters: aFilter,
success: function(oData, oResponse){
console.log(oData);
},
error: function(oError){
console.log("Error!");
console.log(oError);
}
}
);
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.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.