title: HTTP/1.1 415 Cannot process the message because the content type 'application/json; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'
body: <p>trying to POST json dictionary to C# WCF, when i invoke it HTTP Response 415. Someone can tell me whats wrong with my code.</p>
  
  <p>object Class</p>
  
  <pre><code> [DataContract]
  public class Class1
  {
      [DataMember]
      public string AccNo;
       [DataMember]
      public string CompanyName;
       [DataMember]
      public string DocDate;
  }
  </code></pre>
  
  <p>IService1.cs</p>
  
  <pre><code>   [OperationContract]
      [WebInvoke(Method = "POST", UriTemplate = "json/PostSalesOrderData", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
          string PostSalesOrderData(string data);
  </code></pre>
  
  <p>Service1.svc.cs</p>
  
  <pre><code> public string PostSalesOrderData(string data)
      {
  
          JavaScriptSerializer serializer = new JavaScriptSerializer();
  
          Dictionary&lt;string, Class1&gt; dict = serializer.Deserialize&lt;Dictionary&lt;string, Class1&gt;&gt;(data);
  
          return dict["Debtor"].AccNo.ToString();
      }
  </code></pre>
  
  <p>Fiddle Details</p>
  
  <p>HTTP/1.1 415 Cannot process the message because the content type 'application/json; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.
  Server: Microsoft-IIS/7.5
  X-Powered-By: ASP.NET
  Date: Thu, 29 Nov 2012 01:21:55 GMT
  Content-Length: 0</p>