on 2018 Aug 03 11:55 AM
Hi
I'm trying to use V4 OData Model for the first time in my app. I'm using CDATA API server to serve the ODATA. I can see the network requests for fetching the metadata and even the entity data are running succesfully.
I can even see the OData-Version value "V4" in Response-Headers.
But, the data in the binded table is not updating and I'm getting this error in console:
Failed to get contexts for http://localhost:8989/api.rsc/treeNodes with start index 0 and length 10 - Error: Expected 'OData-Version' header with value '4.0' but received value 'null' in response for http://localhost:8989/api.rsc/treeNodes?$select=displayName,id&$skip=0&$top=10
at R.doCheckVersionHeader (https://openui5.netweaver.ondemand.com/resources/sap/ui/core/library-preload.js:3564:314)
Here's the metadata of my service:
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="4.0" xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx">
<edmx:DataServices>
<Schema Namespace="CData" xmlns="http://docs.oasis-open.org/odata/ns/edm">
<EntityType Name="loggingNodes">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="serverId" Type="Edm.Int32" Nullable="false"/>
<Property Name="opcNodeId" Type="Edm.String" Nullable="false" MaxLength="2147483647" />
<Property Name="displayName" Type="Edm.String" Nullable="false" MaxLength="2147483647" />
<Property Name="queueSize" Type="Edm.Int32" Nullable="false"/>
<Property Name="nodeId" Type="Edm.Int32" Nullable="false"/>
<Property Name="dataChangeTrigger" Type="Edm.Decimal" Nullable="false"/>
<Property Name="deadbandValue" Type="Edm.Double" Nullable="false"/>
<Property Name="id" Type="Edm.Int32" Nullable="false"/>
<Property Name="publishingInterval" Type="Edm.Int32" Nullable="false"/>
<Property Name="samplingInterval" Type="Edm.Int32" Nullable="false"/>
<Property Name="discardOldest" Type="Edm.Int32" Nullable="false"/>
<Property Name="deadbandType" Type="Edm.Int32" Nullable="false"/>
</EntityType>
<EntityType Name="treeNodes">
<Key>
<PropertyRef Name="id" />
</Key>
<Property Name="type" Type="Edm.String" Nullable="false" MaxLength="2147483647" />
<Property Name="opcNodeId" Type="Edm.String" Nullable="false" MaxLength="2147483647" />
<Property Name="parentId" Type="Edm.Int32" Nullable="false"/>
<Property Name="displayName" Type="Edm.String" Nullable="false" MaxLength="2147483647" />
<Property Name="serverId" Type="Edm.Int32" Nullable="false"/>
<Property Name="id" Type="Edm.Int32" Nullable="false"/>
</EntityType>
<EntityContainer Name="CData">
<EntitySet Name="loggingNodes" EntityType="CData.loggingNodes" />
<EntitySet Name="treeNodes" EntityType="CData.treeNodes" />
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
I'm getting the same error while trying to access either of the entitysets.
Here's the response-headers that I'm getting:
Access-Control-Allow-Origin:
https://webidetesting9762247-p1940161775trial.dispatcher.hanatrial.ondemand.com
Cache-Control:
private
Content-Type:
application/json;charset=utf-8
Date:
Fri, 03 Aug 2018 10:47:24 GMT
OData-Version:
4.0
Server:
Microsoft-HTTPAPI/2.0
Transfer-Encoding:
chunked
X-AspNet-Version:
2.0.50727
X-Powered-By:
CData API Server
I went ahead and did some debugging based on the error that I'm receiving in the console and found the issue in the following place:
resources/sap/ui/model/odata/v4/lib/_Requestor-dbg.js
Requestor.prototype.doCheckVersionHeader = function (fnGetHeader, sResourcePath,bVersionOptional) {
var sODataVersion = fnGetHeader("OData-Version"),
vDataServiceVersion = !sODataVersion && fnGetHeader("DataServiceVersion");
if (vDataServiceVersion) {
throw new Error("Expected 'OData-Version' header with value '4.0' but received"
+ " 'DataServiceVersion' header with value '" + vDataServiceVersion
+ "' in response for " + this.sServiceUrl + sResourcePath);
}
if (sODataVersion === "4.0" || !sODataVersion && bVersionOptional) {
return;
}
throw new Error("Expected 'OData-Version' header with value '4.0' but received value '"
+ sODataVersion + "' in response for " + this.sServiceUrl + sResourcePath);
};
This is function that's throwing the error.
Is there any setting to disable this check or to force the framework to accept that the response is in-fact V4 ODATA?
Please help me resolving this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
11 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.