Question on Exception Handeling in webservices?

Discussion in 'ASP .Net Web Services' started by ltnats@yahoo.com.au, Jul 4, 2006.

  1. Guest

    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.
    , Jul 4, 2006
    #1
    1. Advertising

  2. Simon Hart Guest

    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.

    <> wrote in message
    news:...
    > 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, Jul 4, 2006
    #2
    1. Advertising

  3. Dale Guest

    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


    "" wrote:

    > 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.
    >
    >
    Dale, Jul 8, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    450
    F. GEIGER
    Mar 21, 2005
  2. mclovin

    handeling very large dictionaries

    mclovin, Jun 29, 2009, in forum: Python
    Replies:
    3
    Views:
    317
    Joseph Turian
    Jun 29, 2009
  3. GMK

    Handeling connection timeout

    GMK, Feb 26, 2005, in forum: ASP .Net Security
    Replies:
    0
    Views:
    105
  4. masmith
    Replies:
    1
    Views:
    931
    masmith
    Feb 20, 2009
  5. jeljer te Wies

    sequel error handeling

    jeljer te Wies, May 31, 2009, in forum: Ruby
    Replies:
    0
    Views:
    82
    jeljer te Wies
    May 31, 2009
Loading...

Share This Page