I am writing a small console application in C# to send a request to REST API and receive the response in XML. below is my code
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
StreamReader reader = new StreamReader(response.GetResponseStream());
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(reader.ReadToEnd());
Console.Write(xmlDoc);
}
I have checked using the fiddler and i am getting 200 response code and result. but while doing xmlDoc.Load(reader.ReadToEnd()); i am getting error.
Can any one help me to solve this? or is there any other way to do this.
I want to write the response XML result into file.
Thanks in advance