[ACCEPTED]-How do you catch a thrown soap exception from a web service?-exception
Accepted answer
You may want to catch the specific exceptions.
try
{
service.StartGame();
}
catch(SoapHeaderException)
{
// soap fault in the header e.g. auth failed
}
catch(SoapException x)
{
// general soap fault and details in x.Message
}
catch(WebException)
{
// e.g. internet is down
}
catch(Exception)
{
// handles everything else
}
0
Catch the SoapException
instance. That way you can access 1 its information:
try {
service.StartGame();
} catch (SoapException e) {
// The variable 'e' can access the exception's information.
}
catch (SoapException soapEx)
{
//Do something with soapEx
}
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.