How to get soapexception details

A

Alpha83

Calling a webservice using HttpWebRequest below. Only WebException
can be caught per documentation. How about SoapException - how do I
get those details. Most web services will throw soapexceptions. Any
way to accomplish this.


public HttpWebResponse SendSoapRequest(string soapEnvelope, string
url)
{
//Setup the Request
WebRequest webRequest = WebRequest.Create(url);
HttpWebRequest httpRequest = (HttpWebRequest)webRequest;
httpRequest.Method = "POST";
httpRequest.ContentType = "text/xml";
httpRequest.Headers.Add("SOAPAction: x");
Stream sendStream= httpRequest.GetRequestStream();
//Add Soap Envelop to the Request
StreamWriter writer = new StreamWriter(sendStream);
writer.Write(soapEnvelope);
writer.Close();
sendStream.Close();
sendStream.Dispose();
//Send the Request
WebResponse response = null;
StreamReader reader = null;
try
{
//Get the response
response = httpRequest.GetResponse();

}
catch (WebException webEx)
{
....



Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top