on 2020 Sep 08 9:23 AM
I have a brand new OData v2 proxy, pointing to a Java based OData v4 CAP service. V4 end point is working as expected, and proxy seems too (it loads metadata and 2 entities with data and no issues).
When launching an app consuming that OData service, it loads metadata but UI5 complains that "M.getMetaModel(...).requestObject is not a function", as you can see in attached image.
As I'm new to OData, I can't tell if that's an issue on my OData or configuration in the UI side, but it works with no issues when consuming OData v4 instead.
I suspect there's something wrong on my manifest.json or how metadata is generated.
Here is the metadata:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Capabilities.V1.xml" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Include Alias="Capabilities" Namespace="Org.OData.Capabilities.V1"/>
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1"/>
</edmx:Reference>
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema Namespace="MasterDataService" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="EntityContainer" m:IsDefaultEntityContainer="true">
<EntitySet Name="BuildingUsageType" EntityType="MasterDataService.BuildingUsageType"/>
<EntitySet Name="Buildings" EntityType="MasterDataService.Buildings"/>
<EntitySet Name="Sites" EntityType="MasterDataService.Sites"/>
<AssociationSet Name="BuildingUsageType_BuildingRef" Association="MasterDataService.BuildingUsageType_BuildingRef">
<End Role="BuildingUsageType" EntitySet="BuildingUsageType"/>
<End Role="Buildings" EntitySet="Buildings"/>
</AssociationSet>
<AssociationSet Name="Buildings_SiteRef" Association="MasterDataService.Buildings_SiteRef">
<End Role="Buildings" EntitySet="Buildings"/>
<End Role="Sites" EntitySet="Sites"/>
</AssociationSet>
</EntityContainer>
<EntityType Name="BuildingUsageType">
<NavigationProperty Name="BuildingRef" Relationship="MasterDataService.BuildingUsageType_BuildingRef" FromRole="BuildingUsageType" ToRole="Buildings"/>
<Property Name="UsageType" Type="Edm.String" MaxLength="50"/>
<Property Name="StartDate" Type="Edm.DateTime" sap:display-format="Date"/>
<Property Name="EndDate" Type="Edm.DateTime" sap:display-format="Date"/>
<Property Name="BuildingRef_Irn" Type="Edm.String" MaxLength="50"/>
</EntityType>
<EntityType Name="Buildings">
<Key>
<PropertyRef Name="Irn"/>
</Key>
<Property Name="Irn" Type="Edm.String" MaxLength="50" Nullable="false"/>
<Property Name="LongName" Type="Edm.String" MaxLength="255"/>
<Property Name="ShortName" Type="Edm.String" MaxLength="30"/>
<NavigationProperty Name="SiteRef" Relationship="MasterDataService.Buildings_SiteRef" FromRole="Buildings" ToRole="Sites"/>
<NavigationProperty Name="UsageTypes" Relationship="MasterDataService.BuildingUsageType_BuildingRef" FromRole="Buildings" ToRole="BuildingUsageType"/>
<Property Name="SiteRef_Irn" Type="Edm.String" MaxLength="50"/>
</EntityType>
<EntityType Name="Sites">
<Key>
<PropertyRef Name="Irn"/>
</Key>
<Property Name="Irn" Type="Edm.String" MaxLength="50" Nullable="false"/>
<Property Name="LongName" Type="Edm.String" MaxLength="255"/>
<Property Name="ShortName" Type="Edm.String" MaxLength="30"/>
<Property Name="Intreno" Type="Edm.String" MaxLength="40"/>
<NavigationProperty Name="Buildings" Relationship="MasterDataService.Buildings_SiteRef" FromRole="Sites" ToRole="Buildings"/>
</EntityType>
<Association Name="BuildingUsageType_BuildingRef">
<End Role="BuildingUsageType" Type="MasterDataService.BuildingUsageType" Multiplicity="*"/>
<End Role="Buildings" Type="MasterDataService.Buildings" Multiplicity="0..1"/>
<ReferentialConstraint>
<Principal Role="Buildings">
<PropertyRef Name="Irn"/>
</Principal>
<Dependent Role="BuildingUsageType">
<PropertyRef Name="BuildingRef_Irn"/>
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="Buildings_SiteRef">
<End Role="Buildings" Type="MasterDataService.Buildings" Multiplicity="*"/>
<End Role="Sites" Type="MasterDataService.Sites" Multiplicity="0..1"/>
<ReferentialConstraint>
<Principal Role="Sites">
<PropertyRef Name="Irn"/>
</Principal>
<Dependent Role="Buildings">
<PropertyRef Name="SiteRef_Irn"/>
</Dependent>
</ReferentialConstraint>
</Association>
<Annotations Target="MasterDataService.EntityContainer/Buildings" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="Capabilities.DeleteRestrictions">
<Record Type="Capabilities.DeleteRestrictionsType">
<PropertyValue Property="Deletable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.InsertRestrictions">
<Record Type="Capabilities.InsertRestrictionsType">
<PropertyValue Property="Insertable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.UpdateRestrictions">
<Record Type="Capabilities.UpdateRestrictionsType">
<PropertyValue Property="Updatable" Bool="false"/>
</Record>
</Annotation>
</Annotations>
<Annotations Target="MasterDataService.EntityContainer/Sites" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="Capabilities.DeleteRestrictions">
<Record Type="Capabilities.DeleteRestrictionsType">
<PropertyValue Property="Deletable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.InsertRestrictions">
<Record Type="Capabilities.InsertRestrictionsType">
<PropertyValue Property="Insertable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.UpdateRestrictions">
<Record Type="Capabilities.UpdateRestrictionsType">
<PropertyValue Property="Updatable" Bool="false"/>
</Record>
</Annotation>
</Annotations>
<Annotations Target="MasterDataService.Sites/Intreno" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="Core.Computed" Bool="true"/>
</Annotations>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Here is manifest.json:
{
"_version": "1.8.0",
"sap.app": {
"id": "buildings",
"type": "application",
"title": "Buildings Details",
"description": "buildings",
"dataSources": {
"MasterDataService": {
"uri": "/v2/MasterDataService/",
"type": "OData",
"settings": {
"odataVersion": "2.0"
}
}
}
},
"sap.ui5": {
"dependencies": {
"libs": {
"sap.fe.templates": {}
}
},
"models": {
"": {
"dataSource": "MasterDataService",
"settings": {
"synchronizationMode": "None",
"operationMode": "Server",
"autoExpandSelect": false,
"earlyRequests": false,
"groupProperties": {
"default": {
"submit": "Auto"
}
}
}
}
},
"routing": {
"routes": [
{
"pattern": ":?query:",
"name": "Buildings",
"target": "Buildings"
}
],
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"async": true,
"viewPath": "buildings.view",
"controlAggregation": "pages",
"clearControlAggregation": false
},
"targets": {
"Buildings": {
"type": "Component",
"id": "Buildings",
"viewType": "XML",
"transition": "slide",
"clearControlAggregation": false,
"viewId": "MarioId",
"viewName": "App",
"options": {
"settings": {
"entitySet": "Buildings"
}
}
}
}
}
}
}
and here my view:
<mvc:View
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc"
xmlns:smartFilterBar="sap.ui.comp.smartfilterbar"
xmlns:smartTable="sap.ui.comp.smarttable"
displayBlock="true"
>
<App id="app">
<pages>
<Page id="page" title="{i18n>title}">
<content>
</content>
</Page>
</pages>
</App>
</mvc:View>
If anyone can help, it would be very nice of you.
Hi Mario,
please try:
services:{"/MasterData": "MasterDataService"}
like in my example: index.js#L19
CU
Gregor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi mario.brandao2
but isn't the V4 endpoint reachable at /master-data ? So you have to use the service-path as described in: https://www.npmjs.com/package/@sap/cds-odata-v2-adapter-proxy#cds-standalone-backend-cap-java-or-cap...
"<odata-v4-service-path>": "<qualified.ServiceName>"
but v2 is working too, for instance, http://0.0.0.0:4004/v2/MasterDataService/$metadata returns the following:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData">
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Capabilities.V1.xml" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Include Alias="Capabilities" Namespace="Org.OData.Capabilities.V1"/>
</edmx:Reference>
<edmx:Reference Uri="https://oasis-tcs.github.io/odata-vocabularies/vocabularies/Org.OData.Core.V1.xml" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:Include Alias="Core" Namespace="Org.OData.Core.V1"/>
</edmx:Reference>
<edmx:DataServices m:DataServiceVersion="2.0">
<Schema Namespace="MasterDataService" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
<EntityContainer Name="EntityContainer" m:IsDefaultEntityContainer="true">
<EntitySet Name="BuildingUsageType" EntityType="MasterDataService.BuildingUsageType"/>
<EntitySet Name="Buildings" EntityType="MasterDataService.Buildings"/>
<EntitySet Name="Sites" EntityType="MasterDataService.Sites"/>
<AssociationSet Name="BuildingUsageType_BuildingRef" Association="MasterDataService.BuildingUsageType_BuildingRef">
<End Role="BuildingUsageType" EntitySet="BuildingUsageType"/>
<End Role="Buildings" EntitySet="Buildings"/>
</AssociationSet>
<AssociationSet Name="Buildings_SiteRef" Association="MasterDataService.Buildings_SiteRef">
<End Role="Buildings" EntitySet="Buildings"/>
<End Role="Sites" EntitySet="Sites"/>
</AssociationSet>
</EntityContainer>
<EntityType Name="BuildingUsageType">
<NavigationProperty Name="BuildingRef" Relationship="MasterDataService.BuildingUsageType_BuildingRef" FromRole="BuildingUsageType" ToRole="Buildings"/>
<Property Name="UsageType" Type="Edm.String" MaxLength="50"/>
<Property Name="StartDate" Type="Edm.DateTime" sap:display-format="Date"/>
<Property Name="EndDate" Type="Edm.DateTime" sap:display-format="Date"/>
<Property Name="BuildingRef_Irn" Type="Edm.String" MaxLength="50"/>
</EntityType>
<EntityType Name="Buildings">
<Key>
<PropertyRef Name="Irn"/>
</Key>
<Property Name="Irn" Type="Edm.String" MaxLength="50" Nullable="false"/>
<Property Name="LongName" Type="Edm.String" MaxLength="255"/>
<Property Name="ShortName" Type="Edm.String" MaxLength="30"/>
<NavigationProperty Name="SiteRef" Relationship="MasterDataService.Buildings_SiteRef" FromRole="Buildings" ToRole="Sites"/>
<NavigationProperty Name="UsageTypes" Relationship="MasterDataService.BuildingUsageType_BuildingRef" FromRole="Buildings" ToRole="BuildingUsageType"/>
<Property Name="SiteRef_Irn" Type="Edm.String" MaxLength="50"/>
</EntityType>
<EntityType Name="Sites">
<Key>
<PropertyRef Name="Irn"/>
</Key>
<Property Name="Irn" Type="Edm.String" MaxLength="50" Nullable="false"/>
<Property Name="LongName" Type="Edm.String" MaxLength="255"/>
<Property Name="ShortName" Type="Edm.String" MaxLength="30"/>
<Property Name="Intreno" Type="Edm.String" MaxLength="40"/>
<NavigationProperty Name="Buildings" Relationship="MasterDataService.Buildings_SiteRef" FromRole="Sites" ToRole="Buildings"/>
</EntityType>
<Association Name="BuildingUsageType_BuildingRef">
<End Role="BuildingUsageType" Type="MasterDataService.BuildingUsageType" Multiplicity="*"/>
<End Role="Buildings" Type="MasterDataService.Buildings" Multiplicity="0..1"/>
<ReferentialConstraint>
<Principal Role="Buildings">
<PropertyRef Name="Irn"/>
</Principal>
<Dependent Role="BuildingUsageType">
<PropertyRef Name="BuildingRef_Irn"/>
</Dependent>
</ReferentialConstraint>
</Association>
<Association Name="Buildings_SiteRef">
<End Role="Buildings" Type="MasterDataService.Buildings" Multiplicity="*"/>
<End Role="Sites" Type="MasterDataService.Sites" Multiplicity="0..1"/>
<ReferentialConstraint>
<Principal Role="Sites">
<PropertyRef Name="Irn"/>
</Principal>
<Dependent Role="Buildings">
<PropertyRef Name="SiteRef_Irn"/>
</Dependent>
</ReferentialConstraint>
</Association>
<Annotations Target="MasterDataService.EntityContainer/Buildings" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="Capabilities.DeleteRestrictions">
<Record Type="Capabilities.DeleteRestrictionsType">
<PropertyValue Property="Deletable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.InsertRestrictions">
<Record Type="Capabilities.InsertRestrictionsType">
<PropertyValue Property="Insertable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.UpdateRestrictions">
<Record Type="Capabilities.UpdateRestrictionsType">
<PropertyValue Property="Updatable" Bool="false"/>
</Record>
</Annotation>
</Annotations>
<Annotations Target="MasterDataService.EntityContainer/Sites" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="Capabilities.DeleteRestrictions">
<Record Type="Capabilities.DeleteRestrictionsType">
<PropertyValue Property="Deletable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.InsertRestrictions">
<Record Type="Capabilities.InsertRestrictionsType">
<PropertyValue Property="Insertable" Bool="false"/>
</Record>
</Annotation>
<Annotation Term="Capabilities.UpdateRestrictions">
<Record Type="Capabilities.UpdateRestrictionsType">
<PropertyValue Property="Updatable" Bool="false"/>
</Record>
</Annotation>
</Annotations>
<Annotations Target="MasterDataService.Sites/Intreno" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<Annotation Term="Core.Computed" Bool="true"/>
</Annotations>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
The issue happens when the UI5 app is launched pointing to that metadata. The metadata is loaded but then it shows the error I have attached as image above.
On the other side, the very same app worked fine when using OData v4
User | Count |
---|---|
67 | |
8 | |
8 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.