Managing exceptions in web services (showing errors)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Diego F.

    #1

    Managing exceptions in web services (showing errors)

    I use to show the error messages that I get in a try block.

    try
    {
    ...
    }
    catch (Exception ex)
    {
    ... (ex.Message);
    }

    In a Windows App I use: Message.Show(ex .Message);

    As the web service can be used in Windows apps or ASP.NET apps, what is the
    way to do that?

    Regards,

    Diego F.


  • Jan Tielens

    #2
    Re: Managing exceptions in web services (showing errors)

    You may want to read following article:
    http://www.microsoft.com/belux/nl/ms...xceptions.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
    _______________ _
    Read my weblog: http://weblogs.asp.net/jan


    "Diego F." <diegofr@NOterr a.es> schreef in bericht
    news:u43%23YusX EHA.2844@TK2MSF TNGP12.phx.gbl. ..[color=blue]
    > I use to show the error messages that I get in a try block.
    >
    > try
    > {
    > ...
    > }
    > catch (Exception ex)
    > {
    > ... (ex.Message);
    > }
    >
    > In a Windows App I use: Message.Show(ex .Message);
    >
    > As the web service can be used in Windows apps or ASP.NET apps, what is[/color]
    the[color=blue]
    > way to do that?
    >
    > Regards,
    >
    > Diego F.
    >
    >[/color]


    Comment

    Working...