cancel
Showing results for 
Search instead for 
Did you mean: 

Implementing OData-Service/Netweaver GW-Service into UI5-App

Former Member
0 Kudos

Hello guys!


After struggling with the setup of the Data-Service for my UI5-App, I started to code the User Interface of my app with mock-data (simply mock.json).

Today, I luckily could setup an accessable Odata-Service, but the jump from mock-data to real data is just too big for me now.

Can someone of you give me a guide or example how I replace my existing mockdata with my real data (in form of an url)?

Thanks in advance!

Here is my code so far:

var oModel = new sap.ui.model.json.JSONModel("model/mock.json");
oView.setModel(oModel);

with best regards

Chung

Accepted Solutions (1)

Accepted Solutions (1)

SandipAgarwalla
Active Contributor
0 Kudos

you will have to create a odata model , and then the bindings.

var oModel = new sap.ui.model.odata.ODataModel("<your service name>");

check the help link for some details,

SAPUI5 SDK - Demo Kit

Former Member
0 Kudos

Thanks alot, Sandip!

Do you maybe now, how I handle 2 different Entity-Sets in 1 Model?

Former Member
0 Kudos

Well, it didnt worked out unfortunately.

Maybe some extra details:

http://wwwproxy.xxx.xx:8080

https://wwwproxy.xxx.xx:8080

ChandraMahajan
Active Contributor
0 Kudos

Hi,

Check this section SAPUI5 SDK - Demo Kit

Regards,

Chandra

Former Member
0 Kudos

It works

But why is the url in the server "localhost/<NameOfAnotherProject>/" and not the project I was running at?

And how can I view this tomcat preview in Chrome?

Thx in Advance

Regards,

Chung

Virinchy
Active Contributor
0 Kudos

Try the same url running in tomcat with chrome and it should work .

The Url hostname is localhost/<ProjectName> because , the server is running in your local machine.

Regards

Virinchy

Former Member
0 Kudos

Tried it, but in chrome I encounter the same problem as in the beginning (

  1. OPTIONS http://<host>:<port>/sap/opu/odata/sap/Z..._SRV/$metadata 401 (Unauthorized) datajs.js:17
  2. OPTIONS http:///<host>:<port>/sap/opu/odata/sap/Z..._SRV/$metadatahttp://ssap182.gisasap.de:8000/sap/opu/odata/sap/ZRPWF_FIORI_GW_SERVICE_SRV/$metadata 401 (Unauthorized) datajs.js:17
  3. XMLHttpRequest cannot load http:///<host>:<port>/sap/opu/odata/sap/Z..._SRV/$metadatahttp://ssap182.gisasap.de:8000/sap/opu/odata/sap/ZRPWF_FIORI_GW_SERVICE_SRV/$metadata. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
Virinchy
Active Contributor
0 Kudos

You might need to specify the proxy settings in chrome as here . Also try again disabling the security of chrome as here.

Regards

Virinchy

ChandraMahajan
Active Contributor
0 Kudos

These are CORS related errors. you can check this blog or may want to deploy your UI5 application to ABAP server. check

Regards,

Chandra

Answers (0)