kinger29 0 Light Poster

I have created a simple web service based off one of the project templates in the Microsoft WCF Starter Kit 2 for .NET 3.5. I have successfully implemented a GET method. However I am having trouble get a POST method to work.

[WebHelp(Comment = "Sample description for DoWork")]
      [WebInvoke(UriTemplate = "DoWork", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
      public SampleResponseBody DoWork(SampleRequestBody request)
                //TODO: Change the sample implementation here
                return new SampleResponseBody()
                    Value = String.Format("Sample DoWork response: '{0}'", request.Data)

Below is the definition of the SampleResponseBody and SampleRequestBody classes:

public class SampleResponseBody
            public string Value { get; set; }
        [DataContract(Name = "SampleRequestBody")]
        public class SampleRequestBody
            [DataMember(Name = "Data")]
            public string Data { get; set; }

When I start debugging my application it runs on my localhost. I go to:
And it gives me error message: "Error Description: 'HTTP Method not allowed'"

Then if I try
I get: "Error Description: 'Resource does not exist'"

I have also tried
And still get: "Error Description: 'Resource does not exist'"

If anyone has any advice it would be greatly appreciated. I have even read RESTful.NET by Jon Flanders and he barely mentions HTTP POST methods. Also if anyone has any useful resources for create a RESTful Web Service in WCF I would appreciate that as well.

Thanks in advance!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.