title: Null values for object properties de-serialized by WCF
body: <p>I have a WCF web service that <em>used</em>  to work fine. Somewhere down the line it stopped and I cant tell why. The code and the interface never changed nor did the web.config (at least not in relation to the web services section). I have a class:</p>
  <pre><code>[DataContract]
  public class QuizServiceArgs
  {
      [DataMember(IsRequired = true, Order = 1)] 
      public int Category1 { get; set; }
  
      [DataMember(IsRequired = true, Order = 2)] 
      public int Category2 { get; set; }
  
      [DataMember(IsRequired = true, Order = 3)] 
      public int Category3 { get; set; }
  
      [DataMember(IsRequired = true, Order = 4)] 
      public int Category4 { get; set; }
  }
  </code></pre>
  <p>And the service interface is simple:</p>
  <pre><code>public interface IQuizService
  {
      [OperationContract]
      [WebInvoke(Method = &quot;POST&quot;,
         BodyStyle = WebMessageBodyStyle.WrappedRequest,
         ResponseFormat = WebMessageFormat.Json)]
      ServiceResult Save(QuizServiceArgs answers, string strvalue, int intvalue);
  }
  </code></pre>
  <p>The second two params <code>strvalue</code> and <code>intvalue</code> were added only for troubleshooting to see if those were getting deserialized -- and they are. When I hit the service, I get an error saying that I'm missing the <code>Category1</code> parameter from the request but as you can see this Fiddler screenshot, the values are there.</p>
  <p><img src="https://i.stack.imgur.com/TgMM2.png" alt="fiddler screenshot" /></p>
  <p><strong>I can get primitive values to pass in but objects seem to all be instantiated with null or default values. What am I doing wrong?</strong></p>
  <h1>UPDATE</h1>
  <p>I never actually got my original question answered which sucks, but Sixto suggested that I switch my serialization to JSON. JSON was the original design but got nixed when I was having trouble with it. After I successfully switched back to JSON, everything was serializing and deserializing properly. Now I am just waiting for this to break for no explanation so I can switch back to XML....</p>