I have a Web API which takes XML as string. Below is my API method
public class ValuesController : ApiController { [HttpPost] public void Submit([FromBody]string document) { } }
I have Microsoft InfoPath Form with Submit Button. The Submit button on the form is configured to post the generated XML using the following URLhttp://localhost:61027/api/Values
Here is what Fiddler Shows when I click on submit
POST http://localhost:61027/api/Values HTTP/1.1 Accept: */* Accept-Language: en-US Content-Type: text/xml; charset=UTF-8 UA-CPU: AMD64 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Win64; x64; Trident/6.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; Tablet PC 2.0) Host: localhost:61027 Content-Length: 449 Connection: Keep-Alive Pragma: no-cache<?xml version="1.0" encoding="UTF-8"?><?mso-infoPathSolution solutionVersion="1.0.0.1" productVersion="14.0.0" PIVersion="1.0.0.0" href="file:///C:\Users\XXXXXX\AppData\Local\Microsoft\InfoPath\Designer3\47f74bc8c618481f\manifest.xsf" language="en-us" ?><?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?><Document><Content><State>AK</State><PropertyType>PP</PropertyType></Content></Document>
so submit button is posting the expected XML but on the server the "document" parameter is always null