Skip to Content
avatar image
Former Member

SAPUI5 [ODataMetadata] initial loading of metadata failed while using OData service

Hi!

I have problem while using OData service with sapui
In manifest.json dataSource contiains:

"adminsRemote": {
  "uri": "/odata.svc/",
  "type": "OData"
}

/odata.svc/$metadata
results:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">  <Schema Namespace="Data" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2007/05/edm">   <EntityType Name="Admin">    <Key>     <PropertyRef Name="id"/>    </Key>    <Property Name="id" Type="Edm.Int64" Nullable="false"/>    <Property Name="username" Type="Edm.String" Nullable="true"/>    <Property Name="email" Type="Edm.String" Nullable="true"/>   </EntityType>   <EntityContainer Name="Data" m:IsDefaultEntityContainer="true">    <EntitySet Name="Admins" EntityType="Data.Admin"/>   </EntityContainer>  </Schema> </edmx:DataServices></edmx:Edmx>

But the same error appeared:
[ODataMetadata] initial loading of metadata faile

In browser network panel I see, that metadata loaded correct, like sample above.

What's wrong?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Oct 06, 2017 at 02:49 PM

    Your odata service is returning the DataServiceVersion 1.0, you need to use a service of at least 2.0.

    Regards,

    Jamie

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 10, 2017 at 08:50 AM

    Check your oData version

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2017 at 12:38 PM

    Hi,

    I am also getting the same error "[ODataMetadata] initial loading of metadata failed" however I am using "odata/v2".

    Actually, i am using my own VM to run the code.

    Code for authorization:

    Code for binding oData response to combobox:

    The problem is when I put a debug point at authorization part then the odata response is successfully binded to combobox but if I do normal run or reload the page then I am getting "[ODataMetadata] initial loading of metadata failed" this error.

    Someone can suggest that what's wrong?

    Thanks,

    Rohit

    Add comment
    10|10000 characters needed characters exceeded

  • Hi,

    You can try adding the gateway destination in your neo-app.json file in your application. I tried this and it worked for me.. Please find my neo-app.json code structure, hope this helps

    Happy Learning!! :)

    {
      "welcomeFile": "/webapp/index.html",
      "routes": [
        {
          "path": "/resources",
          "target": {
            "type": "service",
            "name": "sapui5",
            "entryPath": "/resources",
            "version": "1.44.35"
          },
          "description": "SAPUI5 Resources"
        },
        {
          "path": "/test-resources",
          "target": {
            "type": "service",
            "name": "sapui5",
            "entryPath": "/test-resources",
            "version": "1.44.35"
          },
          "description": "SAPUI5 Test Resources"
        },
        {
          "path": "/sap/opu/odata",
          "target": {
            "type": "destination",
            "name": "ABC_SAMPLE,
            "entryPath": "/sap/opu/odata"
          },
          "description": "ABC_SAMPLE"
        }
      ],
      "sendWelcomeFileRedirect": true
    }
    
    Add comment
    10|10000 characters needed characters exceeded