5
votes

Context:Currently using WCF Data Services 5.0 with Odata for a Windows 8 Store application.

Have been trying to compress the OData coming over the wire from my service today and running into plenty of issues surrounding support.

  • binary serialization isn't supported.

  • json isn't supported (library throws 'application/json' is currently not supported in Content-Type header)

  • json lite isn't released yet

  • adding gzip requests in the http response works (server returns compressed) - but client side lib doesn't seem to want to deserialize it. (xml parsing exceptions)

My final attempt today was to try and get a hold of the http response, and to manually deserialize the stream myself (GZipStream isn't available but i know there are 3rd party alternatives) - but I couldn't find ANY Microsoft.Data.Services.Client.WindowsStore events/overrides that would expose the stream to me.

I wanted to implement OData to leverage the performance and efficiency gains over standard WCF Web services - but with no way to compress the stream over the wire i don't get any.

Does anyone have any experience with this, or advice of how to approach?

1
I know that OData Xml format is verbose but how much data you are actually sending? Maybe you can just send less data... Is there any specific reason for which you are trying to compress the data?Pawel
I am sending the minimum amount of data I can for any given UI screen. The two target devices for the application are the Surface RT and the Windows Phone 7. Compressing the data over the wire is crucial to respecting any bandwidth restrictions the devices may have.Patrick McCurley
For windows phone 7, there is a event called ReadingResponse exposed in DataServiceContext class. Take a read on this article blogs.msdn.com/b/astoriateam/archive/2011/10/04/…Syler

1 Answers

1
votes

Have you followed the same steps here to get json response.The client has to send MaxDataServiceVersion header: http://blogs.msdn.com/b/astoriateam/archive/2012/04/11/what-happened-to-application-json-in-wcf-ds-5-0.aspx

I also checked that Odata 5.1.0 has been released on nuget. This has the better json support: https://nuget.org/packages/Microsoft.Data.Services/5.1.0

Your other option is to use asp.net web api and try the odata support: http://www.nuget.org/packages/Microsoft.AspNet.WebApi.OData