C
Chris Dunaway
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
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