It is quite easy to send XML using the HttpClient in asp.net core. In order to do this you need to use the StringContent object, provide it with an XML string, an encoding format and a mediatype. The XML string provided will form the body of the HTTP request. A full example on how to do this can be seen below:
var httpClient = new HttpClient(); var someXmlString = "<xml><someTag>someValue</someTag></xml>"; var stringContent = new StringContent(someXmlString, Encoding.UTF8, "application/xml"); var respone = await httpClient.PostAsync("/someurl", stringContent);
That is it, I hope this post was of help to you.