Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question on Exception Handeling in webservices?

0 views
Skip to first unread message

ltn...@yahoo.com.au

unread,
Jul 3, 2006, 8:45:43 PM7/3/06
to
Hi there,
I have been developing a webservices data access layer for a
project I am working on. I have researched exception handling in
webservices and found that global handling of unhandled exceptions can
be done using a SOAP Extension. I have implemented one of these
successfully. However if the webservice does not get invoked with a
client proxy; (eg using a HTTP Get request like when you press the
Invoke button in IE after browsing to the service.asmx file) the SOAP
Extension does not get executed and as a result neither does my global
exception handler. Information about the exception is returned to the
browser in text form, showing the error and method/line number it
happened on. I want to prevent this from happening and log the
exception details and send back a SOAP Exception as I do in my global
exception handler. How can I do this for HTTP Get requests on my
webservices?

Thank you for your time,

Scott.

Simon Hart

unread,
Jul 4, 2006, 6:48:42 AM7/4/06
to
I must admit I have never heard of using a SoapExtension to handle unhandled
exceptions via ASP.NET Web Services. Do you have a link to the site you
learned this from? Generally SoapExtensions are used to trap the SOAP
messages so you can modify or log data. Usually you wouldn't write your
exception handling logic around this.

Have you not tried using the Global.asax Application_Error then calling
Context.Error.GetBaseException to handle unhandled exceptions?

I must admit I always disable HTTPGET and HTTPPOST to avoid malicious hacker
attempts.

Regards
Simon.

<ltn...@yahoo.com.au> wrote in message
news:1151973943....@75g2000cwc.googlegroups.com...

Dale

unread,
Jul 8, 2006, 2:26:01 PM7/8/06
to
Depending on your application and expected consumers of your webservice, you
might also consider what I do in some web services: I catch the exception in
my webmethod and return an out parameter:

[WebMethod]
public string HelloWorld(out string error)
{
......
}


--
Dale Preston
MCAD C#
MCSE, MCDBA

0 new messages