Re: WSE 2.0 and structured Exceptionhandling
From: Henning Krause (newsgroup.no_at_spam.infinitec.de)
Date: 08/23/04
- Next message: William Stacey [MVP]: "Re: WSE 2.0 and structured Exceptionhandling"
- Previous message: Sidd: "Re: WSE Settings 2.0... does not work"
- In reply to: William Stacey [MVP]: "Re: WSE 2.0 and structured Exceptionhandling"
- Next in thread: William Stacey [MVP]: "Re: WSE 2.0 and structured Exceptionhandling"
- Reply: William Stacey [MVP]: "Re: WSE 2.0 and structured Exceptionhandling"
- Messages sorted by: [ date ] [ thread ]
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)
> >
> >
> >
>
- Next message: William Stacey [MVP]: "Re: WSE 2.0 and structured Exceptionhandling"
- Previous message: Sidd: "Re: WSE Settings 2.0... does not work"
- In reply to: William Stacey [MVP]: "Re: WSE 2.0 and structured Exceptionhandling"
- Next in thread: William Stacey [MVP]: "Re: WSE 2.0 and structured Exceptionhandling"
- Reply: William Stacey [MVP]: "Re: WSE 2.0 and structured Exceptionhandling"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|