0
votes

i am trying to connect sapui5/openui5 ODataModel to an odata-server. I want to use a nodejs server with package simple-odata-server. Unfortunately this odata server provides metadata only in xml-format. But sapui5 tries to load metadata in json-format.

Before i switch to another odata server, i want to check, wether sapui5 can load metadata in xml-format. I tried to create the model with several parameters, but ODataModel still tries to load metadata as json.

var oModel = new ODataModel("/odata", {
    "metadataUrlParams": "$format=xml",
    "json": false
});

Does anybody know, wether i can switch to $format=xml

Thanks in advance, Torsten

2
Not a solution to your specific problem, but Helmut Tammen has developed a nodejs OData server specifically for use with SAPUI5: github.com/htammen/n-odata-server You may want to try thisQualiture
the n-odata-server project seems to be a goot alternative. i will try it.Torsten

2 Answers

0
votes

As far as I know the OData protocol metadata is always provided as XML, never seen metadata in JSON format. Also my n-odata-server Qualiture mentioned in the comment above does it. But I never had problems with SAPUI5. It requests the metadata, gets the xml stream and works with it.

0
votes

Since the metadataUrlParams parameter is of type map I'd suppose it would at least do what you intend like this:

var oModel = new ODataModel("/odata", {
  "metadataUrlParams": {
    "$format": "xml"
  }
});

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