Comments (8)
Here is the definitive reference for the differences between OData 2 and 4: http://docs.oasis-open.org/odata/new-in-odata/v4.0/cn01/new-in-odata-v4.0-cn01.html
There are also a couple of summaries of the difference between OData v2 and v4:
- https://dzone.com/articles/whats-new-with-odata-4-odata-2-vs-odata-4
- https://www.progress.com/blogs/whats-new-with-odata-4-odata-2-vs-odata-4
I've gone with the munging approach as a bit of an exploration. For my particular service, these are the sticking points that I have found so far:
- The xml namespace schema declarations have to be updated to the OData v4 ones (
http://schemas.microsoft.com/ado/2008/09/edm
->http://docs.oasis-open.org/odata/ns/edm
,http://schemas.microsoft.com/ado/2007/06/edmx
->http://docs.oasis-open.org/odata/ns/edmx
). <NavigationProperty>
syntax is different. v2 does not have a Type property (from what I can tell, type is inferred by referring to the type of the values that are linked to), v4 requires it to be set explicitly on the property declaration itself. To get my schema to compile, I had to comment out the<NavigationProperty>
elements for now.- Some of the primitive data types have changed, in particular Edm.DateTime has been deprecated. It seems that the client generator at the moment doesn't handle the deprecated type and skips it. Had to change these to make it work.
It would be nice if this was more seamless, but I now have a schema that compiles and is hitting remote servers. Ready for the next hurdle! 😄 Thanks for your help @davidmoten .
from odata-client.
I don't know. I'm not familiar with v2. I'll have a short look at what's changed. What product are you connecting to?
from odata-client.
Can you give me your v2 metadata to see what the differences are?
from odata-client.
Thanks for the response @davidmoten. Unfortunately, I'm not sure that I can give you the metadata for my specific service due to its licensing, but I found another sample OData v2 service online here:
https://services.odata.org/V2/OData/OData.svc/$metadata
The main difference between it and mine seems to be the version of the schema XML namespace used for the <Schema>
element (the sample service reports http://schemas.microsoft.com/ado/2007/05/edm and my service is using http://schemas.microsoft.com/ado/2008/09/edm). I'm not sure how much of a difference that makes. There are also some extra proprietary attributes on the <Property>
elements of the 'EntityType' declarations.
from odata-client.
Upon investigation:
I was getting an NPE here:
This could be a bug or a misconfiguration error on my part (even if it's a misconfiguration error, I'd consider it a bug that the diagnostics aren't more useful). I'll continue to investigate.
from odata-client.
V2 does look very similar. You might be able to modify the metadata file to make it comply with V4 and then use the generated client.
The xml namespace will be important. You will want to modify the namespaces to look like this simple example in V4:
The null pointer is probably because you are loading a file with a root element of a completely different namespace and the t
in your code extract ends up being null because there is no match at all.
from odata-client.
Thanks for the response David. I've come to a similar conclusion. I'm having a bit of a play with it at the moment.
There were two causes of the NPE. One of them I reported in #145. The other is I think due to the reason that you specified.
I managed to track down XSD files for OData v2; I'll see if these can be incorporated. Otherwise, munging my xml to make it look like OData v4 might work.
from odata-client.
Nice work @kriegfrj !
from odata-client.
Related Issues (20)
- NPE when running odata-client-maven-plugin through Java 11 HOT 10
- Batch requests? HOT 6
- Create client for Graph v1.0 behind a proxy doesn't work HOT 6
- How to get partial range of content of a drive item(file) HOT 9
- DriveItem does not have the @microsoft.graph.downloadUrl property HOT 6
- Issue with Microsoft Dynamics EntityDefinitions/RelationshipDefinitions HOT 2
- Onedrive delta link, does not give top(2), but gives all changes though top is added HOT 3
- [Documentation] Authentication with OData Service HOT 7
- Cannot deserialize UnsignedByte using Serializer.deserialize HOT 5
- upload file to onedrive through createUploadSession - itemWithPath() not found HOT 4
- httpResponse of odata.client.HttpResponse put(String s, .List<RequestHeader> list, InputStream inputStream, int i,HttpRequestOptions httpRequestOptions) does not give reponse body in httpResponse.getText() as post() method gives. HOT 8
- odata\client\TestingService.class- not returning response body for patchOrPut() method. HOT 17
- post() now does a HTTP PUT HOT 4
- HttpPatch Delta<T> parameter is always Null HOT 1
- odata-client-runtime dependency on jaxb-core and jaxb-impl HOT 2
- Unable to generate a client with dynamics finance and operations metadata HOT 10
- Support "Evolvable Enumerations" with a default value HOT 5
- Hit java reserved identifier 'package' HOT 5
- Automatic mapping of "expanded" objects support? HOT 4
- Requesting an individual resource - request produced using path parameter instead of ID in brackets encoded in URL HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from odata-client.