Using: .NET Framework 4.7, Postman. I make a POST request with Postman, Content-Type is set as "application/xml", to a .NET Framework 4.7 Web API.
The request body looks like this:
<Simple xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<example>hello</example>
</Simple>
The Controller API looks like this:
[HttpPost]
[Route("test")]
public HttpResponseMessage test(Simple myRequest)
{
return Request.CreateResponse(HttpStatusCode.OK, "helo world");
}
The class is:
public class Simple
{
public string example { get; set; }
}
For some reason, the variable "myRequest" is always null!
I have also tried with the request body:
<myRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<example>hello</example>
</myRequest >
Do I need to add to Global.asax some formatting configuration or some setting anywhere?
Thanks!