Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3843784
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:59:14+00:00 2026-05-19T15:59:14+00:00

I’ve just finished my first WCF 4.0 Rest service and don’t understand why the

  • 0

I’ve just finished my first WCF 4.0 Rest service and don’t understand why the Content-Type of the data being returned changes between calling the service via Fiddler and Firefox. Here’s my service contract:

[ServiceContract]
public interface IProjectService
{
    [OperationContract]
    [WebGet(UriTemplate = "project/{id}/json", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
    ProjectDataContract GetProjectJson(string id);

    [OperationContract]
    [WebGet(UriTemplate = "project/{id}/xml", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml)]
    ProjectDataContract GetProjectXml(string id);

    [OperationContract]
    [WebGet(UriTemplate = "userprojects/{userKey}/json", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)]
    List<ProjectDataContract> GetProjectsByUserJson(string userKey);

    [OperationContract]
    [WebGet(UriTemplate = "userprojects/{userKey}/xml", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml)]
    List<ProjectDataContract> GetProjectsByUserXml(string userKey);
}

As you can see, I’m setting the response format for each operation. If the request ends with “/json” then I’m returning json data. If the request ends with “/xml”, then xml data is returned. At least that is what my intentions are.

When I make a call to http://localhost:5050/ProjectServiceLibrary/project/27/xml in Firefox, I can see the content-type is set to “text/html” whereas the same request invoked in fiddler shows the correct content type of “application/xml”. Same thing happens for a call to a “/json” suffixed request – “text/html” in firefox and “application/json” in fiddler.

So, why is this happening? Which one do I trust? I downloaded JSONView Firefox add-on, but that makes everything look like json. It treats the XML as JSON.

I’m sure I’m missing something obvious. Any help would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:59:15+00:00Added an answer on May 19, 2026 at 3:59 pm

    This is related to the Accept header in the request sent by the client. The Accept header contains a prioritized list of MIME types. Accept headers are defined by the client (Firefox, Fiddler), and tell the server which content-types it is capable of receiving. The server will use the best match based on priority and compatibility.

    Accept headers generated by FireFox give text/html a higher priority – telling the server to send text/html if it is possible. You will probably find that Fiddler does the opposite, giving application/xml the higher priority – this explains what you are seeing.

    There’s more detailed information about request headers on Kris Jordans blog.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am using JSon response to parse title,date content and thumbnail images and place
I am trying to understand how to use SyndicationItem to display feed which is
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I don't have much knowledge about the IPv6 protocol, so sorry if the question
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I want to construct a data frame in an Rcpp function, but when I
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.