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

The Archive Base Latest Questions

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

I got a REST WCF Service running in .net 4 and I’ve tested the

  • 0

I got a REST WCF Service running in .net 4 and I’ve tested the web service it is working and accepting HttpRequest I make to it. But I ran into a problem trying to access the HttpRequest body within the web service. I’ve tried sending random sizes of data appended on the HttpRequest using both Fiddler and my WinForm app and I can’t seem to find any objects in runtime where I can find my request body is located. My initial instinct was to look in the HttpContext.Current.Request.InputStream but the length of that property is 0, so I tried looking in IncomingWebRequestContext that object doesn’t even have a method nor properties to get the body of the HttpRequest.

So my question is, is there actually a way to access the HttpRequest request body in WCF?

PS:
The data inside the request body is JSON strings and for response it would return the data inside response body as JSON string too.

  • 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-22T15:59:17+00:00Added an answer on May 22, 2026 at 3:59 pm

    Much simpler, this answer on WCF + REST: Where is the request data? works fine.

    Also, if your request body is deserializable, you can just pass a class. Barring some typos, this should work:

    public class Banana
    {
        public string Colour;
        public int Size;
    }
    

    …

    [WebInvoke(
        Method = "POST", 
        UriTemplate = "bananas", 
        ResponseFormat=WebMessageFormat.Json, 
        RequestFormat=WebMessageFormat.Json)]
    string CreateBanana(Banana banana);
    

    …

    public string CreateBanana(Banana banana)
    {
        return "It's a " + banana.Colour + " banana!";
    }
    

    Doing POST with data {"Colour": "blue", "Size": 5} to this resource should return "It's a blue banana!".

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

Sidebar

Related Questions

I just got off a small project using a WCF/REST Web Service that used
I've got a node.js REST service running on mongoose and express. I'm also using
I created a new wcf rest service using .net 4. I have created a
I have an iPhone simulator app as client and WCF-REST, json encoded service running
I've got a REST hello world service up and running with ServiceStack. It currently
I've got a Java REST based web service sitting on a server which is
I've got a WCF REST Service which I'd like to unit test. i.e -
I've got a REST-ful WCF service that returns back an XML response. It is
I've got a simple REST based service for which I am trying to create
So I'm trying to create a C# WCF REST service that is called by

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.