title: POST to WCF from Fiddler succeeds but passes null values
body: <p>I've followed <a href="http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Hosting-WCF-Services-in-IIS/" rel="nofollow noreferrer">this video series on WCF</a> and have the demo working.  It involves building a WCF service that manages student evaluation forms, and implements CRUD operations to operate on a list of those evaluations.  I've modified my code a little according to <a href="http://msdn.microsoft.com/en-us/library/dd203052.aspx" rel="nofollow noreferrer">this guide</a> so it will return JSON results to a browser or Fiddler request.  My goal is to figure out how to use the service by building my own requests in Fiddler, and then use that format to consume the service from an app on a mobile device.</p>
  
  <p>I'm having trouble using the <code>SubmitEval</code> method (save an evaluation) from Fiddler.  The call works, but all the fields of <code>Eval</code> are null (or default) except <code>Id</code>, which is set in the service itself.</p>
  
  <p>Here is my <code>Eval</code> declaration (using properties instead of fields as per <a href="https://stackoverflow.com/questions/7058942/how-to-call-wcf-restful-service-from-fiddler-by-json-request">this question</a>):</p>
  
  <pre><code>[DataContract]
  public class Eval //Models an evaluation
  {
      [DataMember]
      public string Id { get; set; }
  
      [DataMember]
      public string Submitter { get; set; }
  
      [DataMember]
      public string Comment { get; set; }
  
      [DataMember]
      public DateTime TimeSubmitted { get; set; }
  }
  </code></pre>
  
  <p>And here is the relevant part of <code>IEvalService</code>:</p>
  
  <pre><code>[ServiceContract]
  public interface IEvalService
  {
   ...
     [OperationContract]
      [WebInvoke(RequestFormat=WebMessageFormat.Json,
         ResponseFormat=WebMessageFormat.Json, UriTemplate = "eval")]
      void SubmitEval(Eval eval);
  }
  </code></pre>
  
  <p>And <code>EvalService</code>:</p>
  
  <pre><code>[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
  class EvalService : IEvalService
  {
  ...
    public void SubmitEval(Eval eval)
      {
          eval.Id = Guid.NewGuid().ToString();
          Console.WriteLine("Received eval");
          evals.Add(eval);
      }
  }
  </code></pre>
  
  <p>In Fiddler's Request Builder, I set the Method to POST and the address to <code>http://localhost:49444/EvalServiceSite/Eval.svc/eval</code>.  I added the header <code>Content-Type: application/json; charset=utf-8</code> to the default headers.  The request body is:</p>
  
  <pre><code>{"eval":{"Comment":"testComment222","Id":"doesntMatter", 
    "Submitter":"Tom","TimeSubmitted":"11/10/2011 4:00 PM"}}
  </code></pre>
  
  <p>The response I get from sending that request is <code>200</code>, but when I then look at the Evals that have been saved, the one I just added has a valid <code>Id</code>, but <code>Comment</code> and <code>Submitter</code> are both null, and <code>TimeSubmitted</code> is <code>1/1/0001 12:00:00 AM</code>.</p>
  
  <p>It seems like WCF is getting the request, but is not deserializing the object correctly.  But if that's the case, I don't know why it's not throwing some sort of exception.  Does it look like I'm doing this right, or am I missing something?</p>
  
  <p>UPDATE: Here is the endpoint declaration in App.config:</p>
  
  <pre><code> &lt;endpoint binding="webHttpBinding" behaviorConfiguration="webHttp"
     contract="EvalServiceLibrary.IEvalService" /&gt;
  </code></pre>
  
  <p>And the endpoint behavior referred to:</p>
  
  <pre><code>&lt;behavior name="webHttp"&gt;
    &lt;webHttp defaultOutgoingResponseFormat="Json"/&gt;
  &lt;/behavior&gt;
  </code></pre>