Hey, super newbie question. Consider the following WCF function:
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class Service1
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
[WebInvoke(UriTemplate = "",
Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare) ]
public SomeObject DoPost(string someText)
{
...
return someObject;
In fiddler what would my request headers and body look like?
Thanks for the help.
I’ve slightly changed your WCF service to have a better example and written a sample test program (see below).
The first test executes a GET request for the URL http://localhost:57211/Service1.svc/getcar/1. The 1 at the end is a parameter. The port number may be different in your case. The result is:
The second test executes a POST request by sending the same data (except Ferrari for Porsche) to the URL http://localhost:57211/Service1.svc/updatecar/1. The result is:
This request has both a parameter in the URL (the 1) plus the request data (a JSON structure) as a second parameter, transmitted as the request body.
With a network debugger, it would look like this (simplified):
I hope that helps.
TestService.cs:
IService.cs:
Service.svc:
Service1.svc (Markup):