The following code, i have used to fetch the response from a paticular
webservice. Same code is working when the request has been from
webserver but in local machine or from the application server
HttpWebResponse.ResponseStream() is throwing system not supported
error. How come it is working in webserver? b'coz of any encoding
issues?


string _sData = string.Empty;
HttpWebRequest _oRequest = null;
HttpWebResponse _oResponse = null;
StreamReader _oReader = null;

_oRequest = (HttpWebRequest)WebRequest.Create("URL");
_oRequest.Headers.Add("SOAPActionURL");
_oRequest.Method = "POST";
_oRequest.ContentType = "text/xml;charset=\"utf-8\"";

byte[] _oRequestByte = Encoding.UTF8.GetBytes(RequestXML);
_oRequest.ContentLength = _oRequestByte.Length;
_oRequest.GetRequestStream().Write(_oRequestByte, 0,
_oRequestByte.Length);
_oRequest.GetRequestStream().Close();

_oResponse = (HttpWebResponse)_oRequest.GetResponse();

if (_oResponse != null)
{
_oReader = new StreamReader(_oResponse.GetResponseStream());
_sData = _oReader.ReadToEnd().ToString().Trim();
}

Reply via email to