title: Using JSON as a parameter for WCF Restservice Method
body: <p>I hope you can help, im trying to upgrade a broken login system so it uses POST instead of GET when transffering login credentials.</p>
  
  <p>It never reaches the actual method so the problem is somewhere between the interface and my javascript.</p>
  
  <p>Interface:  </p>
  
  <pre><code>[OperationContract]
          [WebInvoke(Method = "POST", 
              BodyStyle = WebMessageBodyStyle.WrappedRequest,
              ResponseFormat = WebMessageFormat.Json,
              RequestFormat = WebMessageFormat.Json, 
              UriTemplate = "/DoLogin")]
          LoginKey DoLogin(string email, string password,string tenant);
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code> $.ajax({
              type: "POST",
              url: "RestService.svc/DoLogin",
              data:'{"email":"' + encodeURIComponent(email) + '","password":"' + encodeURIComponent(password) + '","tenant":"' + encodeURIComponent(tenant) + '"}',
              dataType: "json",
              cache: false,
              success: function (loginKey) {
  ... rest of method
  </code></pre>
  
  <p>The JSON data i send is valid:
  {
      "email": "mail",
      "password": "somepassword",
      "tenant": "tenantid"
  }
  Any ideas whats going wrong here? It worked just fine with GET</p>
  
  <p>ps here is the first line of the actual login rest service method:</p>
  
  <pre><code>public LoginKey DoLogin(string email, string password, string tenant)
          {
  </code></pre>