I try to post an XML file to the url and get the response back. I have this code to post. I am not really sure how to check if it is posting correctly and how to get the response.
WebRequest req = null; WebResponse rsp = null; // try // { string fileName = @"C:\ApplicantApproved.xml"; string uri = "http://stage.test.com/partners/wp/ajax/consumeXML.php"; req = WebRequest.Create(uri); req.Method = "POST"; // Post method req.ContentType = "text/xml; encoding='utf-8'"; // Wrap the request stream with a text-based writer StreamWriter writer = new StreamWriter(req.GetRequestStream()); // Write the XML text into the stream writer.WriteLine(this.GetTextFromXMLFile(fileName)); writer.Close(); // Send the data to the webserver rsp = req.GetResponse();
I think I should have the response in rsp but I am not seeing anything usufull on it.
Lillian Martin
03-Nov-2014