Overriding response format

Topics: Web Api
Nov 14, 2011 at 1:52 PM

I am a total web.api newbie. I am evaluating migrating an existing app that uses WCF REST + syndication classes. So example I have a service operation:

        [WebGet(UriTemplate = "{feed}", ResponseFormat = WebMessageFormat.Xml)]
        Atom10FeedFormatter GetFeed(string feed);

On the client side I am using jQuery-mobile RC to send ajax requests. I set the request to accept "xml" but I always get a JSON response. I read another post which explained that "All AJAX libraries send the X-Requested-With header so if requested from AJAX then you will get json".  I removed both the jsonFormatter and the jsonValueFormatter but the response is the same.

Why am I still getting json?

How do I get XML?

Nov 16, 2011 at 7:10 AM

You may be hitting a known bug where the removed formatters don’t actually get removed. This will be fixed in the next preview.

Daniel Roth