title: ASP.NET MVC4 WebAPI and Posting XML data
body: <p>I'm missing a trick with the new webapi - I'm trying to submit an xml string through a post request and not having much luck.</p>
  
  <p>The front end is using jQuery like this:</p>
  
  <pre><code>    $(document = function () {
      $("#buttonTestAPI").click(function () {
  
          var d = " &lt;customer&gt;&lt;customer_id&gt;1234&lt;/customer_id&gt;&lt;/customer&gt;";
          $.ajax({
              type: 'POST',
              contentType: "text/xml",
              url: "@Url.Content("~/api/Customer/")",
              data: d,
              success: function (result) {
                  var str = result;
                  $("#output").html(str);
              }
          });
      });
  });
  </code></pre>
  
  <p>My controller is pretty simple at the moment - just the default for the post action - trying to return what was passed in:</p>
  
  <pre><code>    public string Post(string value)
      {
          return value;
      }
  </code></pre>
  
  <p>However, "value" is repeatedly null. The odd thing is, when I change my data in the jquery to be something like this:</p>
  
  <pre><code>d = "&lt;customer_id&gt;1234&lt;/customer_id&gt;";
  </code></pre>
  
  <p>Then I get "value" in my controller as 1234.</p>
  
  <p>How can I get access to the more complex xml string in my controller?</p>