More Complex Operations in ADO.NET Data Services
page 4 of 5
by Sergey Zwezdin
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 26557/ 31

Data Representation Formats

By default ADO.NET Data Services web-services returns data in AtomPub format. Such representation is very convenient in most cases because it is hierarchically structured, easy readable to perceive without additional parsing. As its building is based on XML format, so a service can be used in an heterogeneous environment.

But sometimes you need to use other data formats. Nowadays ADO.NET Data Services platform supports two formats - AtomPub and JSON. JSON format is easy to use to interact with JavaScript client scenarios.

ADO.NET Data Services defines a format to response automatically. It occurs on the basis of "Accept" header in HTTP-request. If this header is empty or it contains "application/atom+xml" value then data will be displayed in AtomPub format. If the header contains "application/json" value then data will be presented in JSON form.

This is the way to choose a data format generated by ADO.NET Data Services.


View Entire Article

User Comments

Title: fasdfa   
Name: asdfasdf
Date: 2012-08-25 7:46:11 AM
Comment:
asdfsdf
Title: developer   
Name: developer
Date: 2011-07-31 1:24:23 PM
Comment:
When I try this in new version of WCF Data Services,
public System.IO.Stream GetCustomerPhoto(string customerId)
generates an exception and says that Stream cannot be serialized and returned.
Do you know why?
Title: System.IO.Stream GetCustomerPhoto?   
Name: Dana
Date: 2010-03-11 2:46:40 PM
Comment:
You can return an image from a service operation? I couldn't figure this out. Can you elaborate on that stub? When I tried to create the service operation and then "update service reference" from my client app, I got an error to the effect that the meta data couldn't be created.
Great article and any further info is appreciated. Thanks,
Dana
Title: moreclick   
Name: moreclick
Date: 2009-12-07 2:17:58 AM
Comment:
Thanks for sharing, I love reading you should post more often...

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-19 8:56:00 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search