cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 ignores localUri setting for data source

0 Kudos
1,244

I have a UI5 app where, in the manifest.json, I have defined an OData data source with a settings/localUri directive that points to a local metadata file.

However, the UI5 framework ignores this directive and instead always fetches the metadata from the service root as defined in uri value of the data source definition.

Why is UI5 ignoring my localUri directive?

Here is a relevant (modified) excerpt from my manifest.json:

"dataSources": {
  "C4C_ODATAAPI": {
    "uri": "https://mynnnnnn.crm.ondemand.com/sap/c4c/odata/v1/c4codataapi/$metadata",
    "type": "OData",
    "settings": {
      "localUri": "localService/c4codataapi.edmx.xml"
    }
  }
}

Accepted Solutions (0)

Answers (2)

Answers (2)

manuelgf
Explorer
0 Kudos

Hi Martin,

Have you found a solution in order to get the application reading the metadata from a local file?

0 Kudos

Hello Manuel,

Unfortunately, I did not manage to resolve this issue. The app eventually went live without this issue being resolved, so I assume it is fetching the remote metadata each time.

Kind Regards,

Martin

Joseph_BERTHE
Active Contributor
0 Kudos

Hello,

That's funny, because, I had exactly the same issue this week, and luckily for you, I found out the solution 🙂

  1. Make sure your localService/metadata.xml is rigth formatted and interpreted
  2. Make sure the annotation file is right as well

Here is my manifest :

            "mainService": {
                "uri": "/sap/opu/odata/sap/ZHR_BLABLABL_SRV/",
                "type": "OData",
                "settings": {
                    "annotations": [
                        "annotation",
                        "ZHR_BLABLABL_ANNO_MDL"
                    ],
                    "localUri": "localService/metadata.xml"
                }
            },
            "annotation": {
                "type": "ODataAnnotation",
                "uri": "annotations/annotation.xml",
                "settings": {
                    "localUri": "annotations/annotation.xml"
                }
            },
            ...

Regards,

In my case, however, it is not even attempting to read the local file from the localUri path.

In F12 in the browser, I only see it loading the metadata from the service root. It does not even attempt to read my local metadata file.

I also do not have any annotation in my app; not sure if that makes a difference, or is important?