Here's my action
public class EmployeesController : ApiController
{
public void Post(int id, Employee employee) //Break point here ...
{
}
}
When I issue the following POST request, things are working perfectly.
http://localhost:64946/api/employees/12345
Host: localhost:64946
Content-Type: application/json
Content-Length: 194
{"Id":12345,"FirstName":"John","LastName":"Human"}
However, when I change the content-type to be application/xml, the employee object is null.
<Employee xmlns="http://schemas.datacontract.org/2004/07/RequestBinding.Models">
<FirstName>John</FirstName>
<Id>12345</Id>
<LastName>Human</LastName>
</Employee>
Am I missing any thing?
UPDATE
I'm using Fiddler to issue request
Thanks for helping
jsonin the body, it works. But when I change content-type toapplication/xmlthen replace json by xml in the body, the employee object in the action becomes null.