Ganesh Wanga

Ganesh Wanga

  • NA
  • 1
  • 652

XML request in NULl

Apr 10 2015 6:38 AM
Hi All,


XML Request is sending to server through HttpWebRequest

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(ServerPath);
request.Timeout = 60000;
request.Method = "POST";
string postData = "XML DATA";

byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentType = "text/xml; encoding='utf-8'";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
responseFromFareBox = reader.ReadToEnd();


It is returning, Object reference not set an instance of an object / Value cannot be null.