Problems Passing Multiple Parameters to Web Service
<p>I have a simple Web Service method defined as:</p>

<pre><code>[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string MyWebMethod(string foo, string bar)
{
    // DataContractJsonSerializer to deserialize foo and bar to
    //  their respective FooClass and BarClass objects.

    return "{\"Message\":\"Everything is a-ok!\"}";
}
</code></pre>

<p>I'll call it from the client via:</p>

<pre><code>var myParams = { "foo":{"name":"Bob Smith", "age":50},"bar":{"color":"blue","size":"large","quantity":2} };

$.ajax({
    type: 'POST',
    url: 'https://mydomain.com/WebServices/TestSvc.asmx/MyWebMethod',
    data: JSON.stringify(myParams),
    contentType: 'application/json; charset=utf-8',
    dataType: 'json',
    success: function (response, status) {
        alert('Yay!');
    },
    error: function (xhr, err) {
        alert('Boo-urns!');
    }
});
</code></pre>

<p>However, this yields the following error (a breakpoint on the first line in MyWebMethod() is never hit):</p>

<blockquote>
  <p>{"Message":"No parameterless
  constructor defined for type of
  \u0027System.String\u0027.","StackTrace":"
  at
  System.Web.Script.Serialization.ObjectConverter.ConvertDictionaryToObject(IDictionary<code>2
  dictionary, Type type,
  JavaScriptSerializer serializer,
  Boolean throwOnError, Object&amp;
  convertedObject)\r\n   at
  System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object
  o, Type type, JavaScriptSerializer
  serializer, Boolean throwOnError,
  Object&amp; convertedObject)\r\n   at
  System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object
  o, Type type, JavaScriptSerializer
  serializer, Boolean throwOnError,
  Object&amp; convertedObject)\r\n   at
  System.Web.Script.Services.WebServiceMethodData.StrongTypeParameters(IDictionary</code>2
  rawParams)\r\n   at
  System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext
  context, WebServiceMethodData
  methodData, IDictionary`2
  rawParams)\r\n   at
  System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext
  context, WebServiceMethodData
  methodData)","ExceptionType":"System.MissingMethodException"}</p>
</blockquote>

<p>I'd like to pass in two string parameters and use DataContractJsonSerializer to write new Foo and Bar objects.  Am I missing something?</p>
