Re: WSE 2.0 and structured Exceptionhandling

From: Henning Krause (newsgroup.no_at_spam.infinitec.de)
Date: 08/23/04


Date: Mon, 23 Aug 2004 10:26:21 +0200

Hello,

I've solved the problem this way:

On the server side, all Webservice inherit from a base webservice class
which in turn inherits from SoapService.

In this class, I override the Receive(SoapEnvelope) method:

protected override void Receive(SoapEnvelope envelope)
{
    try
        {
            base.Receive(envelope);
        }
        catch (Exception ex)
        {
            throw new SoapException(ex.Message,
SoapException.ClientFaultCode, "", WrapException(ex.InnerException));
        }
    }
}

The WrapException method takes the type and all public properties (via
reflection) and creates an XmlDocument with these informations.

This Document is then passed along to the SoapException. The XmlDocument is
now available on the client via the SoapException.Details property.

On the client, I've created a WebServiceInvokationException which unwraps
the SoapException and makes the public properties of the original excption
available via a NameValue Collection.

Greetings,
Henning Krause
==========================
Visit my website: http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(http://www.infinitec.de/?page=products)

"William Stacey [MVP]" <staceywREMOVE@mvps.org> wrote in message
news:#KXyjUthEHA.3980@TK2MSFTNGP12.phx.gbl...
> I have the same question Henning. Not sure detailedErrors what right
> either. Maybe all your reply documents have a shared enum at the top for
> return status and also share the exceptions so you can just "switch" the
> enum (or if it) and throw the exception locally - not sure.
>
> --
> William Stacey, MVP
>
> "Henning Krause" <newsgroup.no@spam.infinitec.de> wrote in message
> news:Oj5nDjohEHA.712@tk2msftngp13.phx.gbl...
> > Hello,
> >
> > I've built a soap.tcp based webservice using WSE 2.0, which runs quite
> > smoothly.
> >
> > When I throw an exception on the server side, the exception in
propagated
> to
> > the client as SoapException.
> >
> > If I turn "detailedErrors" on, I get the message of the original
exception
> > somewhere in the message of the SoapException.
> >
> > But the innerException is empty, so I cannot access the original
> exception.
> >
> > Here is the declaration of my Exception:
> > [Serializable]
> >
>
[XmlRoot(Namespace=http://nospamproxy.netatwork.de/WebServices/ProxyConfigur
> > ation/ConfigurationException)]
> > public class CustomException: Exception
> > {
> > public CustomException(string message): base(message) {}
> > public CustomException(SerializationInfo info, StreamingContext
> > context):base(info, context) {}
> > public CustomException(string message, Exception innerException):
> > base(message, innerException) {}
> >
> > }
> >
> > In the client app, I've included a reference to the assembly where the
> above
> > exception is declared.
> >
> > Is it possible to get full exception handling with WSE 2.0 or do I have
to
> > go back to the bad old days and return status-codes from my webservice?
> >
> > Any help would be appreciated.
> >
> >
> > Greegings,
> > Henning Krause
> > ==========================
> > Visit my website: http://www.infinitec.de
> > Try my free Exchange Explorer: Mistaya
> > (http://www.infinitec.de/?page=products)
> >
> >
> >
>



Relevant Pages

  • Re: Code design ideas?
    ... app and the webservice, etc. ... Errors of type 1 should be handled by the client side. ... Usually it is the Message of the Exception. ... severity levels: warning and error. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Soap Faults
    ... Exceptions are returned in a .NET client via a SoapException. ... It is possible that the SoapException wraps another exception. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: howto get exception information from asp.net webservice, without try and catch
    ... client, a saopexception gets generated from this fault ... exception occurs) to a standard error side that is invoked when a ... SoapException se = new SoapException("Concurrency ... Typically the client of your webservice is not a human, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: WSE 2.0 and structured Exceptionhandling
    ... "Henning Krause" wrote in message ... > This Document is then passed along to the SoapException. ... > now available on the client via the SoapException.Details property. ... >>> When I throw an exception on the server side, ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • RE: Problemes with custom Webservices and security.
    ... that generates exception in your finally block. ... the ASP.NET will redirect your client to the error page. ... security context. ... > I have a client that calls a Webservice, ...
    (microsoft.public.sharepoint.portalserver.development)

Loading