Skip to Content
0
Jul 16, 2019 at 06:19 AM

Consuming REST API via destination service in Neo environment?(avoiding direct Ajax calls)

850 Views

Hi All,

I am trying to consume Rest API via destination service in my UI5 application.

But it is giving the following error:

Please find below the steps i followed :

1.Backed system is onPremise system:Hence using cloud connector to establish the connection.

hcp cockpit screenshot.

2.Declared Destination in hana cockpit:

3.Defined destination in neo-app.json file.

{ "path": "/P4MSAPI", "target": { "type": "destination", "name": "P4MSAPI" }, "description": "User Data API" }

4.Defined model and datasource in manifest.json file

"P4MSAPI": { "type": "sap.ui.model.json.JSONModel" }

_______________________________________________________________________________________

"sap.app": { "id": "SampleP4MS.SampleP4MS", "type": "application", "i18n": "i18n/i18n.properties", "applicationVersion": { "version": "1.0.0" }, "title": "{{appTitle}}", "description": "{{appDescription}}", "sourceTemplate": { "id": "servicecatalog.connectivityComponentForManifest", "version": "0.0.0" }, "dataSources": { "P4MSAPI": { "uri": "/P4MSAPI/user", "type": "JSON" } } },

5.Trying to directly bind model(P4MSAPI) in view file.

approach 1:

<Title textAlign="Left" titleStyle="H5" text="{P4MSAPI>/name}">

OR approach 2:

// creates a model and attach it to the view

this.getView().setModel(new JSONModel(), "P4MSAPI");

// do a GET request

this.getModel("P4MSAPI").loadData( "/P4MSAPI/user" );

Please suggest what can be done in such case.

Attachments

destination.jpg (75.0 kB)
capture.jpg (42.8 kB)
cc.jpg (31.5 kB)
error1.jpg (29.5 kB)