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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:15:49+00:00 2026-05-24T05:15:49+00:00

I am using the WCF REST Template to test out REST Development. I am

  • 0

I am using the WCF REST Template to test out REST Development. I am trying to test a POST Method defined like this:

    [WebInvoke(UriTemplate = "", Method = "POST")]
    public SampleItem Create(SampleItem instance)
    {
        // TODO: Add the new instance of SampleItem to the collection
        return new SampleItem() { Id = 1, StringValue = "Hello Post" };
    }

However I cant figure out how to get it to accept my SampleItem Parameter. I am using fiddler to submit a POST Request to http://ipv4.fiddler:54916/service1 with the following Header:

User-Agent: Fiddler
Host: ipv4.fiddler:54916

I have tried the following two solutions for the Request Body:

SampleItem.Id=1&SampleItem.StringValue=TestValue

AND

<SampleItem xmlns="http://schemas.datacontract.org/2004/07/PerTrac.Cloud.Service.Statistic">
  <Id>2147483647</Id>
  <StringValue>String content</StringValue>
</SampleItem>

However all I am able to get back is a 400 error.

SampleItem looks like this:

    // TODO: Edit the SampleItem class
    [DataContract]
    public class SampleItem
    {
        [DataMember]
        public int Id { get; set; }

        [DataMember]
        public string StringValue { get; set; }
    }

How can I pass SampleItem to the service without getting a 400 error ???

  • 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-24T05:15:49+00:00Added an answer on May 24, 2026 at 5:15 am

    The first example won’t work (application/x-www-forms-urlencoded is not supported by WCF out-of-the-box). The second example should work if: 1) the namespace of the SampleItem class is PerTrac.Cloud.Service.Statistic; and 2) if you add a Content-Type header to the request (Content-Type: text/xml).

    If it doesn’t work, then try enabling tracing on the server side. The trace will have an information saying why the request is being rejected by WCF.

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

Sidebar

Related Questions

I'm trying to consume twitter's REST api mentioned at this link using WCF REST
I have created a REST web service using WCF and use HTTP Post Method.
I'm using WCF REST service with API key template and trying to enforce validation
I'm using WCF, REST and pretty URI's as shown in this blog post with
I am using WCF REST Preview 2 to test some REST services. The package
I would like to start using the WCF Rest Starter Kit's HttpClient to build
I am using WCF REST Start kit to build a RESTFul service. I defined
I'm using WCF to create some REST service. One of the Rest Service method
I've been trying to consume a .net WCF rest service using JAX-WS lately. Due
I'm using the WCF Rest service application project template in visual studio. I'm just

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.