REST service does not get POST payload

I have a big problem. I created a WCF service.My POST declaration looks like this:

[OperationContract]
[WebInvoke(UriTemplate = "json/put", 
           Method = "POST", 
           BodyStyle = WebMessageBodyStyle.Wrapped, 
           RequestFormat = WebMessageFormat.Json, 
           ResponseFormat = WebMessageFormat.Json)]
string PutData(string jsonText);

I was expecting that when I'm sending data (I'm using fiddler2 to test it) that it will automaticly "put" into the jsonText variable. The service works, but there is no data :(.

Can anybody help? The whole project

Answers


WCF expects the JSON payload to be deserialized into a type. Try creating a class that is shaped like your JSON payload and use that as the parameter type.


Need Your Help

What is the package name of the Google Play app and the AndroidPIT app?

android installation package

What is the package name of the Google Play app and the AndroidPIT app?

NSTimer stops in the background after some time

iphone ios objective-c

I used NSTimer to call a method after 1 sec when app goes in background and after nearly 17 minutes timer stops working.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.