Soap response truncated (SoapUi returns correct response)

630 views Asked by At

Actually I get a truncated soap response. SoapUI returns the response NOT truncated so I assume the issue is somewhere in the way I retrieve the response.

this is how I get the response.

request is of type HttpWebRequest

...
  using (WebResponse Serviceres = request.GetResponse())
  {
    using (StreamReader rd = new StreamReader(Serviceres.GetResponseStream()))
    {
      string ServiceResult = rd.ReadToEnd();
      ...
      ...
      ...
    }
  }
...

the string in "ServiceResult" is finally truncated. Maybe StreamReader is the problem?

1

There are 1 answers

0
Martin Felber On BEST ANSWER

Finally I found the reason for this.

I had to define an encoding and pass it to the StreamReader constructor

Encoding enc = Encoding.GetEncoding("utf-8");

...
using (WebResponse Serviceres = request.GetResponse())
{
  using (StreamReader rd = new StreamReader(Serviceres.GetResponseStream(), enc))
  {
    string ServiceResult = rd.ReadToEnd();
    ...
    ...
    ...
  }
}
...

After that I get the complete response.