title: ServiceStack - REST service does not deserialize json to request object
body: <p>I have created a REST service in ServiceStack, but when I call it with the REST URL, it doesn't deserialize the JSON I post the service into my request object. If I use the default URL or supply the parameters in the query string it works fine. </p>
  
  <p>My request object:</p>
  
  <pre><code>[Route("/myservice", "POST")]
  public class MyRequestObject
  {
      public string MyString { get; set; }
      public int MyInt { get; set; }
  }
  </code></pre>
  
  <p>My Service:</p>
  
  <pre><code>public class MyService : Service
  {
      public object Post(MyRequestObject request)
      {
          return new
              {
                  MyString = request.MyString,
                  MyInt = request.MyInt
              };
      }
  }
  </code></pre>
  
  <p>And the json I post to the service:</p>
  
  <pre><code>{"myString": "abc", "myint": 42}
  </code></pre>
  
  <p>My REST URL is /api/myservice and the default URL is /api/json/asynconeway/MyRequestObject. I have verified that the service get's called with both the REST and default URL.</p>
  
  <p>Thanks a bunch for your input.</p>
  
  <h1>Success headers</h1>
  
  <h2>Request</h2>
  
  <pre><code>POST /api/json/asynconeway/MyRequestObject HTTP/1.1
  Host: bd.local
  Connection: keep-alive
  Content-Length: 32
  Origin: chrome-extension://aejoelaoggembcahagimdiliamlcdmfm
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4
  Accept: application/json
  Accept-Encoding: gzip,deflate,sdch
  Accept-Language: da-DK,da;q=0.8,en-US;q=0.6,en;q=0.4
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  </code></pre>
  
  <h2>Response</h2>
  
  <pre><code>HTTP/1.1 200 OK
  Cache-Control: private
  Content-Type: application/json; charset=utf-8
  Server: Microsoft-IIS/7.5
  COMMERCE-SERVER-SOFTWARE: Microsoft Commerce Server, Enterprise Edition
  X-Powered-By: ServiceStack/3,914 Win32NT/.NET
  X-AspNet-Version: 4.0.30319
  X-Powered-By: ASP.NET
  Date: Mon, 01 Oct 2012 10:32:37 GMT
  Content-Length: 29
  </code></pre>
  
  <h1>Error headers</h1>
  
  <h2>Request</h2>
  
  <pre><code>POST /api/myservice HTTP/1.1
  Host: bd.local
  Connection: keep-alive
  Content-Length: 32
  Origin: chrome-extension://aejoelaoggembcahagimdiliamlcdmfm
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4
  Accept: application/json
  Accept-Encoding: gzip,deflate,sdch
  Accept-Language: da-DK,da;q=0.8,en-US;q=0.6,en;q=0.4
  Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
  </code></pre>
  
  <h2>Response</h2>
  
  <pre><code>HTTP/1.1 200 OK
  Cache-Control: private
  Content-Type: application/json; charset=utf-8
  Server: Microsoft-IIS/7.5
  COMMERCE-SERVER-SOFTWARE: Microsoft Commerce Server, Enterprise Edition
  X-Powered-By: ServiceStack/3,914 Win32NT/.NET
  X-AspNet-Version: 4.0.30319
  X-Powered-By: ASP.NET
  Date: Mon, 01 Oct 2012 10:30:38 GMT
  Content-Length: 11
  </code></pre>