Question

I have a RESTful service with WCF. It has an interface with a method

[OperationContract]
[WebInvoke(Method = "GET", UriTemplate = "AddBook/{bookName}", BodyStyle =     WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
void AddBook(string bookName);

and my service localhost:1234/MService/AddBook/abcd-book is working. But if I change GET to POST, it says method not allowed. I thought, inserting should be POST but it is not working. Am I wrong or doing something wrong with the coding above?

Regards

Was it helpful?

Solution

Typing URL in browser will send GET request by default. To send a POST request, either create a HTML form or use tool like Fiddler.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top