I\'m trying to figure out how to properly serialize my XmlDocument and send it via a HTTPWebRequest object.
Here\'s what I have thus far:
Stream reques
Works (somewhat)! Thanks, heres the code:
Stream requestStream;
Stream responseStream;
WebResponse response;
StreamReader sr;
byte[] postData;
string postString;
postString = xmlAccess.OuterXml + xmlRequest.OuterXml;
postData = Encoding.UTF8.GetBytes(postString);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://wwwcie.ups.com/ups.app/xml/Track");
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = postData.Length;
requestStream = request.GetRequestStream();
requestStream.Write(postData, 0, postData.Length);
requestStream.Close();
response = request.GetResponse();
responseStream = response.GetResponseStream();
sr = new StreamReader(responseStream);
return sr.ReadToEnd();
It still doesnt return proper XML though:
<...
Not sure why there's 2x