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 8429799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:26:12+00:00 2026-06-10T05:26:12+00:00

Looking for some way to make one post method in WCF restful service which

  • 0

Looking for some way to make one post method in WCF restful service which can accept both xml and json. I can see that is possible with Get method which automatically returns json/xml based on request header.

One solution I could think of is:

  1. Get the post data as “Stream” and read it to a string.
  2. Check request header and deserialize it to json or xml.
  3. Set OutgoingResponse format accrodingly and return response.

I’m able to do #1 but stuck in #2 and #3.

  • 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-06-10T05:26:14+00:00Added an answer on June 10, 2026 at 5:26 am

    Microsoft has already done this for you, don’t reinvent the wheel.

    public class DataController : ApiController
    {
        public void Post(DataModel model)
        {
            // Whether the body contains XML, JSON, or Url-form-encoded it will be deserialized
            // into the model object which you can then interact with in a strongly-typed manner
        }
    }
    
    public class DataModel
    {
        public string PropertyA { get; set; }
        public string PropertyB { get; set; }
    }
    

    You can download ASP.NET MVC4 for free which includes the new Web API. http://www.asp.net/mvc/mvc4 . This is basically the final product of the WCF Web API, which is no longer supported. Unless you have so much code already written with the original Web API that it wouldn’t be practical to make the switch, this will save you a lot of time in the long run. Otherwise you will be stuck with a Beta product that has bugs which will never be fixed.

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

Sidebar

Related Questions

I'm looking for a way to send some hidden form-data to a Django-server, which
I'm looking for a package the browser's back button for dired. i.e. some way
Looking for some advice on the best way to implement localization along with client
I am looking for some assistance in a way to configure my .conf file
I'm looking for some advice on the best way to provide a single place
I spent some time looking for a way of resolving my issue but with
I'm looking for a way to group some ui elements together just like the
I am looking for a way to define some syntax coloring for a language
I'm looking for a way to use some variant of vsnprintf() with a buffer
I am looking for a way to remove some characters from the end of

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.