title: POST JSON data to .asmx webservice
body: <p>I'm trying to post some simple parameters to a .asmx webservice.<br>
  I get the following error: <strong><em>Request format is invalid: application/json; charset=utf-8.</em></strong><br>
  What I really need to get to is to be able to pass a complex object, but I can't get past making a POST request with json content type.</p>
  
  <p>Here is my WebService Definition  </p>
  
  <pre><code>[WebMethod]
  [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
  public int JsonTest2(int myparm1, int myparm2)
  {
      return 101;
  }
  </code></pre>
  
  <p>And this is my javascript code</p>
  
  <pre><code>function JsonTest2() {
      $.ajax({
          type: 'POST',
          url: "http://localhost/WebServices/MyTest.asmx/JsonTest2",
          data: "{myparm1:105,myparm2:23}",
          contentType: 'application/json; charset=UTF-8',
          dataType: 'json',
          async: false,
          success: function (msg) {
              alert(msg);
          },
          error: function (msg) {
              alert('failure');
              alert(msg);
          }
      });
  }
  </code></pre>