Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

How to force application/atom+xml output from WebAPI 2 OData service

$
0
0

I'm trying to construct an OData WebAPI service in Visual Studio 2013, to provide a data interface to SAP Business Intelligence tools (4.1 SP2).

I'm using Mike Wasson's OData tutorials (http://code.msdn.microsoft.com/ASPNET-Web-API-OData-cecdb524) as a starting point.

The SAP tool supports hitting OData 2.0 data sources, and can successfully read metadata and query from https://api.datamarket.azure.com/data.gov/Crimes/v1

It appears that $select was added to WebAPI OData with Visual Studio 2013. The default output format is jsonLITE, which is an OData 3.0 addition.

Mike's articles say to request other formats like application/atom+xml by sending appropriate Accept headers.

The problem is, the SAP tool doesn't send any Accept headers, and I can't find any way to get it to do so.

So I was wondering how to get the WebAPI OData service to output atom+xml by default.

I am successfully reading metadata from the WebAPI OData service, but SAP is choking when I run a $select on a table, with error message

"

ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.

"


Viewing all articles
Browse latest Browse all 4850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>