Skip to Content
-1

Consuming XSodata in SAP UI5

Jan 31 at 03:38 AM

33

avatar image
Former Member

Dear Experts,

Created Xsodata and its working fine. But while consuming the XSodata in UI5 . In controller passed the XSodata url and trying to retrieve the odata values in UI5.

Its getting Uncaught in promise error in browser console.

Please let me know your comments.

Thanks,

Ravi

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

2 Answers

Efim Parshin Jan 31 at 08:59 AM
0

Hi! Please share some code from your controller.

Share
10 |10000 characters needed characters left characters exceeded
Emanuele Ricci Jan 31 at 09:15 AM
0

Hi Efim could you please provide us some code or a jsfiddle link?

To consume xsodata you have to bind that service to an OData Model.

var oModel = models.createODataModel("./service/service.xsodata", {
	json: true,
	useBatch: false,
	refreshAfterChange: true,
	headers: {
		"X-Requested-With": "X",
		"Content-Type": "application/json",
		"sap-client": "209"
	}
	
});
this.setModel(oModel, "oDataModel");

After that you can use oDataModel inside your controller/view to bind it.

Share
10 |10000 characters needed characters left characters exceeded