Skip to Content
0

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

Oct 06, 2017 at 02:21 PM

2.6k

avatar image
Former Member

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Jamie Cawley
Oct 06, 2017 at 02:49 PM
0

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

Regards,

Jamie

Share
10 |10000 characters needed characters left characters exceeded
Arjun Biswas Oct 10, 2017 at 08:50 AM
0

Check your oData version

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member
Oct 17, 2017 at 12:38 PM
0

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


1.png (17.6 kB)
2.png (42.2 kB)
Share
10 |10000 characters needed characters left characters exceeded
0

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
}
Share
10 |10000 characters needed characters left characters exceeded