Skip to Content
0

error while calling odata

Sep 22, 2017 at 07:06 AM

51

avatar image
Former Member

Hi all,

while calling odtaa i am geting

XMLHttpRequest: Network Error 0x4c7, The operation was canceled by the user.

pls help....

var sServiceUrl = "https://ldcisd4.wdf.sap.corp:44302/sap/opu/odata/sap/ZBOOK_SRV_01/ZBOOKINgSet?$format=json"; var post = $.ajax({ url : sServiceUrl, type : "GET" }); that = this; post.done(function(data) { var oModel = new sap.ui.model.json.JSONModel(); oModel.setData(data); that.getView().setModel(oModel); });

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Arjun Biswas Sep 25, 2017 at 11:25 AM
0

Use the following code to call an OData service :-

var modelo =new  sap.ui.model.odata.v2.ODataModel("proxy/http/services.odata.org/V2/OData/OData.svc/");

This is the standard way in SAPUI5 to call an model. You can use AJAX also, but the sap.ui.model class makes it easier to work with the OData service.

Hope this helps,

Show 2 Share
10 |10000 characters needed characters left characters exceeded

this is not standard......

it is just a workaround for your local testing......never for real life....

0

Okay, I am in the process of learning SAPUI5. As I tried using this method, I posted the same. Could you please suggest the standard method which is used at real time.

0
Joseph BERTHE Sep 25, 2017 at 05:51 AM
0

Hello,

Use a JSONModel :)

I mean, instead of using $.ajax call, use loadData from JSONModel, you will see it is easier ;)

Share
10 |10000 characters needed characters left characters exceeded