Wednesday, June 19, 2019

Read the Response message when a web request throws “500 Internal Server Error”


When I call a SOAP request from Postman I got the response as “500 Internal Server Error”. I had to call the same api from C# and read the response and had to pass it from api to front end.

Here is the screenshot of the response.


                string soapResult = string.Empty;
                    using (WebResponse webResponse = webRequest.EndGetResponse(asyncResult))
                        using (StreamReader rd = new StreamReader(webResponse.GetResponseStream()))
                            soapResult = rd.ReadToEnd();
                catch (WebException wex)
                    soapResult = new StreamReader(wex.Response.GetResponseStream())
                return soapResult;

1 comment:

  1. Thank you so much it is actually a very nice blog written to provide adequate information about SOAP and its related aspects.

    Powerbi Read Soap