Why is WebResponse truncating XML?

173 views Asked by At

I have the following code, sometimes its fine but others it truncates the xml, so i think its something to do with the length as it just splits in the middle of an xml tag.

            using (WebResponse response = request.GetResponse())
            {
                using (Stream streamResponse = response.GetResponseStream())
                {
                    using (StreamReader rd = new StreamReader(streamResponse, Encoding.UTF8))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(T));

                        string soapResult = rd.ReadToEnd();
                    }
                }
            }

Has anyone got any ideas why its doing this and what i can do to fix it?

0

There are 0 answers