Final solution was to change the Post param type to XElement
:
[Route("api/razorXmlRequest")]
public class RazorXmlRequestController : ApiController
{
/// <summary>
/// Raw Razor request XML
/// </summary>
/// <returns>Razor reply message as text</returns>
[HttpPost]
public async Task<HttpResponseMessage> Post([FromBody]XElement xml)
{
HttpResponseMessage resp = new HttpResponseMessage(HttpStatusCode.OK);
RazorSession cred = RzWebApi.Cred;
string reply = await RzWebApi.RazorSrv.xmlRequests.Request(cred, xml);
resp.Content = new StringContent(reply, System.Text.Encoding.UTF8, "application/xml");
return resp;
}
}
This worked straight-away without even providing the XmlFormatter
as the gentlemen had suggested above (@TusharJ, thank you anyway for your input).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…