just because your httpwebresponse isn't null, doens't mean it has a
response stream. what HTTP response code does the response object show
in cases of failure? you might have a proxy issue or other simple
connectivity issue. or maybe you're getting a redirect -- make sure
you're handling redirects if that's a possibility.

∞ Andy Badera
∞ +1 518-641-1280
∞ This email is: [ ] bloggable [x] ask first [ ] private
∞ Google me: http://www.google.com/search?q=andrew%20badera



On Mon, Sep 14, 2009 at 12:55 AM, Mohan Kumar <[email protected]> wrote:
>
> 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