cissharp
cissharp

Reputation: 216

WCF POST not working but GET working

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

Upvotes: 0

Views: 583

Answers (1)

YK1
YK1

Reputation: 7622

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.

Upvotes: 1

Related Questions