Check out following article that covers this topic:
http://www.microsoft.com/belux/nl/ms...ens/soapexcept
ions.mspx
Throwing SoapExceptions
Summary:
Sometimes things can go wrong when code is executed, so Exceptions are
thrown. When your application exposes services through a webservice layer,
SoapExceptions are thrown from the server to the client. By default normal
Exceptions are converted to a SoapException, resulting in a rather ugly
Exception containing all information concatenated in a long String. But
luckily the SOAP protocol allows any XML document to be included in SOAP
error messages. This article shows how to build some helper classes to
easily pass error information from the server to the client through a
webservice layer.
--
Greetz
Jan Tielens
________________________________
Read my weblog:
http://weblogs.asp.net/jan
"Chris Dunaway" <dunawayc@_lunchmeat_sbcglobal.net> wrote in message
news

jwg5qhhnul.1w1a09j3evsz7$....
> I'm creating a Web service and a Windows Forms application to consume it.
> My question is about throwing a custom exception inside the WebService.
> Can that be done, and can the custom web service be handled in the Windows
> Forms app?
>
> For example, suppose in my WebService, I have the following exception
> class:
>
> '\\\\\
> <Serializable()> _
> Public Class WebServiceException
> Inherits ApplicationException <<<<<<< Is this correct?
>
> 'Code for exception class here
>
> End Class
> ./////
>
> And then within my web method:
>
> '\\\\\
> <WebMethod()> _
> Public Sub SomeWebMethod()
>
> If SomeCondition Then
> Throw New WebServiceException
> End If
> End Sub
> '/////
>
>
> On the Windows Forms client, I can only trap for generic exceptions not my
> custom exception type:
>
> Try
> WebService.SomeWebMethod
> Catch ex As WebServiceException <<<<<<<<< This doesn't work
> 'Handle it
> End Try
>
>
> Anyone know of a way to achieve this?
>
> Thanks for any pointers
>
> --
> Chris
>
> To send me an E-mail, remove the underscores and lunchmeat from my E-Mail
> address.