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

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top