Skip to Content
avatar image
Former Member

Manifest.json adding odata model properties

Hi,

Im having application with manifest.json like following and I want to add

OdataModel properties like headers /user /pass. where should I put it ?

https://sapui5.hana.ondemand.com/sdk/#docs/api/symbols/sap.ui.model.odata.ODataModel.html#setHeaders

{
"_version": "1.5.0",
"sap.app": {
"id": "${project.artifactId}",
"type": "application",
"i18n": "i18n/i18n.properties",
"applicationVersion": {
"version": "${project.version}"
},
"title": "{{appTitle}}",
"description": "{{appDescription}}",
"tags": {
"keywords": []
},
"ach": "dsf",
"resources": "resources.json",
"dataSources": {
"mainService": {
"uri": "/Ne/Customers/",
"type": "OData",
"settings": {
"localUri": "localService/metadata.xml"
}
}
},
"offline": false,
"sourceTemplate": {
"id": "ui5template.smartTemplate",
"version": "1.40.12"
}
},
"sap.ui": {
"technology": "UI5",
"icons": {
"icon": "",
"favIcon": "",
"phone": "",
"phone@2": "",
"tablet": "",
"tablet@2": ""
},
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
},
"supportedThemes": [
"sap_hcb",
"sap_belize"
]
},
"sap.ui5": {
"resources": {
"js": [],
"css": []
},
"dependencies": {
"minUI5Version": "${sap.ui5.dist.version}",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.ui.comp": {},
"sap.uxap": {},
"sap.suite.ui.generic.template": {},
"sap.ui.layout": {},
"sap.ushell": {},
"sap.collaboration": {}
},
"components": {}
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/i18n.properties"
},
"i18n|sap.suite.ui.generic.template.ListReport|ShoppingListHeaders": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/ListReport/ShoppingListHeaders/i18n.properties"
},
"i18n|sap.suite.ui.generic.template.ObjectPage|ShoppingListHeaders": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/ObjectPage/ShoppingListHeaders/i18n.properties"
},
"i18n|sap.suite.ui.generic.template.ObjectPage|ShoppingListItems": {
"type": "sap.ui.model.resource.ResourceModel",
"uri": "i18n/ObjectPage/ShoppingListItems/i18n.properties"
},
"": {
"dataSource": "mainService",
"settings": {
"defaultBindingMode": "TwoWay",
"defaultCountMode": "Inline",
"refreshAfterChange": false
}
}
},
"extends": {
"extensions": {}
},
"contentDensities": {
"compact": true,
"cozy": true
}
},
"sap.ui.generic.app": {
"pages": [
{
"entitySet": "ShoppingListHeaders",
"component": {
"name": "sap.suite.ui.generic.template.ListReport",
"list": true
},
"pages": [
{
"entitySet": "ShoppingListHeaders",
"component": {
"name": "sap.suite.ui.generic.template.ObjectPage"
},
"pages": [
{
"navigationProperty": "to_ShoppingListItems",
"entitySet": "ShoppingListItems",
"component": {
"name": "sap.suite.ui.generic.template.ObjectPage"
}
}
]
}
]
}
]
},
"sap.fiori": {
"registrationIds": [],
"archeType": "transactional"
},
"sap.platform.hcp": {
"uri": ""
}
}
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Nov 24, 2017 at 01:42 PM

    Hello,

    Best practice is to use destinations for this, those u can create in the CP cockpit. (provide username & password here)

    Then in your WebIDE on the project rightclick to add OData Service

    Then in descriptor editor of manifest add new model based on the new odata source

    Kind regards

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 26, 2017 at 09:24 PM

    Nevertheless, please do not put any user/pass in JavaScript application !!! Each file are downloaded into the browser, so with a debugger it will be possible to read it !!!

    Change your design ;)

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 15 at 04:01 PM

    For the OData which require authentication, where do we provide the header info like "authorization" in the manifest to create the model?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 28 at 05:20 AM

    Hi,

    You can add here.

    "": {
    "dataSource": "mainService",
    "settings": {
    "defaultBindingMode": "TwoWay",
    "defaultCountMode": "Inline",
    "refreshAfterChange": false
    "headers" : {"myHeader":"myHeaderValue",...}
    "user": "guru",
    "password": "trythis"
    }

    Other properties can be used check mParameters

    https://openui5.hana.ondemand.com/#/api/sap.ui.model.odata.v2.ODataModel/constructor

    Regards,

    Gururaj

    Add comment
    10|10000 characters needed characters exceeded