I serialize my exceptions to a SoapHeader in a Soap Extensions and recontiture and throw it on the client.
Of course this only works in .Net to .net situations, but it allow me to code my exception handling independent of my Data Access Method.
Gary Davidson
From: Bill Bassler <[EMAIL PROTECTED]> Reply-To: "Unmoderated discussion of advanced .NET topics." <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: [ADVANCED-DOTNET] Serialize a System.Exception into a web method messaging container Date: Fri, 13 Aug 2004 12:46:28 -0400
I have a simple .net container object that represents a standard xml response from a webmethod that can contain exceptions, validation responses and results. I know the WS frame automatically handles serialization of exceptions to soapExceptions but in order to provide a consistent container to a client. I'd like to be able to catch any exceptions and stuff them in the container before returning it to the client.
public class ResponseMessage { public Result Results; public MessageList Messages; public Exception Exception; }
I get the following error.
The property 'TargetSite' on type 'System.Exception' cannot be serialized because it is decorated with declarative security permission attributes. Consider using imperative asserts or demands in the property accessors.
Question: Is what I'm trying to do a good idea. Returning a consistent xml response message to the client perspective? From the research I've done it is. Should just generate a SoapException directly?
=================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in:
Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet
View archives and manage your subscription(s) at http://discuss.develop.com
=================================== This list is hosted by DevelopMentor� http://www.develop.com Some .NET courses you may be interested in:
Essential .NET: building applications and components with CSharp August 30 - September 3, in Los Angeles http://www.develop.com/courses/edotnet
View archives and manage your subscription(s) at http://discuss.develop.com
