Skip to Content
-1

OData SAPUI5

Mar 08, 2017 at 06:41 PM

244

avatar image

So, I am using this example https://sapui5.hana.ondemand.com/sdk/explored.html#/sample/sap.m.sample.InputStates/code/V.view.xml


But I need to consume a remote OData service(http://services.odata.org/Northwind/Northwind.svc), and not a local JSON.

How can I do it?

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

3 Answers

Best Answer
Srikanth KV Mar 08, 2017 at 07:28 PM
0

Since your UI5 application is running on a different server when compared to oData Model you will encounter Same-origin policy issues.

Below solution is only for WebIDE with HCP account.

Step 1: Create HCP destination as per Walkthrough tutorial by changing neo-app.json and manifest.json


Step 2: in the view change the binding to refer to the model from manifest.json

Model name in manifest.json is invoice

Code is taken from the explored app, and changed only dialog fragment file.

<core:FragmentDefinition
	xmlns="sap.m"
	xmlns:core="sap.ui.core">
	<SelectDialog
		title="Products Test"
		class="sapUiPopupWithPadding"
		items="{invoice>/Products}"
		search="_handleValueHelpSearch"
		confirm="_handleValueHelpClose"
		cancel="_handleValueHelpClose">
		<StandardListItem
			iconDensityAware="false"
			iconInset="false"
			title="{invoice>ProductName}"
			description="{invoice>QuantityPerUnit}" />
	</SelectDialog>
</core:FragmentDefinition>


Output:



Share
10 |10000 characters needed characters left characters exceeded
Jun Wu Mar 08, 2017 at 08:23 PM
0
Show 1 Share
10 |10000 characters needed characters left characters exceeded

This url get a error "Missing required request header. Must specify one of: origin,x-requested-with"

0
Jun Wu Mar 09, 2017 at 02:01 PM
0

just use it in your code, you will see the difference, if i am not wrong.

Share
10 |10000 characters needed characters left characters exceeded