Writing a JSON payload with ODataLib 2

In a previous post, I demonstrated the simplest way write a single entity payload with ODataLib, the low-level OData serialization library. That example included just the bare essentials required for writing, but you’ll need more than that for most real-world scenarios. For example, writing a payload in the new JSON format requires some extra setup, ...

Working with Atom metadata

ODataLib can make producing or consuming OData Atom payloads much easier than it would be if you were working with the XML directly. But by not having total control over the XML, you might find yourself in a position where you need to write or read parts of the Atom payload that are defined by ...

Fix for error message: No TypeName was found for ODataComplexValue…

I’ve seen several users of ODataLib run into this error message, so I thought I ought to provide a place where others can hopefully land via a search engine query. If you get an ODataException thrown with this message: No TypeName was found for an ODataComplexValue of an open property, ODataEntry or custom instance annotation, ...

Creating an IEdmModel from a $metadata document

Let’s say you’re a client and you want to turn the CSDL at an OData server’s $metadata endpoint into an instance of IEdmModel that you can ask questions about or pass along to ODataLib (which requires a model for JSON reading and writing). This is all it takes: C# HttpWebRequest request = HttpWebRequest.CreateHttp("http://services.odata.org/v3/odata/OData.svc/$metadata"); ClientHttpResponseMessage metadataMessage ...

ODataLib Basics: Simple Entry Writer

Here’s a change of pace from the recent “deep dives” I’ve been posting: How do you use ODataLib to write an entry? Of course, ODataLib has lots of hooks and settings, as well as the ability the support more advanced OData payloads. But I think a simple, fully-contained example helps to demonstrate what’s really critical ...

OData Links and Blogosphere Buzz

A couple recent highlights in the world of OData: Youssef from the WebAPI team explains how to quickly create an OData service using ASP.NET WebAPI. Team Foundation Service (TFS) now makes its data accessible via OData. The JBoss Teiid project just released its 8.3 beta, which includes preliminary support for OData. In case you missed ...

Reading and Writing Batch Payloads with ODataLib

What is “batch”? The OData protocol allows clients to batch together multiple operations into a single payload using the MIME multipart/mixed format (see RFC 2046 for details). An OData client can combine several query or update requests into one “meta-payload” and then POST the entire meta-payload to the $batch endpoint of an OData service. After ...

Creating an OData JSON server with ODataLib: Part 0

This is the first post in a series on how to use ODataLib to create a server that supports the new v3 JSON format for OData. This post will primarily be an introduction to the new format. We’ll get into the nitty-gritty details of the ODataLib API for supporting it in future posts. Update (May ...

ODataLib API Deep-Dive: SerializationTypeNameAnnotation 1

Just to keep you on your toes, I’ve decided that my first post will be one of those highly-specific deep-dives and not a gentle overview of ODataLib. This post describes the OM (object model) annotation class, SerializationTypeNameAnnotation, simply because it’s something I’ve been getting my hands dirty with lately. More general posts will follow soon. What ...

About

Hello, and welcome to my new blog! I’m a developer on the OData team at Microsoft, and I decided I need a place to channel all my random bits of advice, protocol details, ODataLib tutorials, and other things I’ve learned while ramping up on OData and WCF Data Services. My current work is focused around ...