RE: Custom SoapFilter for WSE 3 and Exceptions



{\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fprq2\fcharset0 MS Sans Serif;}}
\viewkind4\uc1\pard\lang2052\f0\fs20 Hello Stephan,
\par
\par From your description, I understand you're developing a soapFilter to intercept some info from the soap message of each webservice method call. However, for exceptions occured in webmethods, you found that they're always encapsulated as a SoapException object. So you wonder how to get the original exception info, correct?
\par
\par Based on my understanding, for ASP.NET webservice, all the server-side unhandled exceptions will be wrappered with a SoapException and then the SoapException will be serailzied as XML element and contained in SOAP message's <fault> standard element. Therefore, if you want to get original exception info at cilent-side, you may need to lookup the properties of SoapException.
\par
\par for server-side, in your case, you're using custom WSE SoapFilter, the SoapEnvelope's "Fault" property contains the SoapException that will also be captured at client-side. And it doesn't contain the original exception info(be encapsulated into SoapException's properties).
\par
\par So far, to intercept the raw exception info in ASP.NET webservice(server-side), one way is to use SoapExtension. The SoapExtension's ProcessMessage method pass in a SoapMessage class instance, it contains a "Exception" property and this Exception instance's "InnerException" property refer to the original unhandled exception. Here are some web articles describing on this:
\par
\par
\par #User Friendly ASP.NET Exception Handling
\par http://www.codeproject.com/aspnet/ASPNETExceptionHandling.asp
\par
\par #Exception Injection Using a Custom SOAP Extension
\par http://haacked.com/archive/2005/06/29/ExceptionInjectionUsingCustomSoapExtension.aspx
\par
\par
\par Actually, the WSE 3.0 component itself is implemented as a SoapExtension, and since it has remove the original exception from the SoapEnvelope, you can not get the original exception instance directly in WSE custom Filter.
\par
\par Hope this helps some. If you have anything unclear on this, please feel free to let me know.
\par
\par Sincerely,
\par
\par Steven Cheng
\par
\par Microsoft MSDN Online Support Lead
\par
\par
\par
\par ==================================================
\par
\par Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifications.
\par
\par
\par
\par Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx.
\par
\par ==================================================
\par
\par
\par
\par This posting is provided "AS IS" with no warranties, and confers no rights.
\par
\par }

Relevant Pages

  • Re: Custom SoapFilter for WSE 3 and Exceptions
    ... I'm sorry about the inability to catch original exception inside WSE filter, ... but custom SOAP extension will do the job. ... always encapsulated as a SoapException object. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: Throwing exception in a try block?
    ... >> Except that in v1.1 using a naked throw causes the stack trace to get ... >> rethrow the original exception type, ... the original exception to the constructor as the InnerException. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: "ensure" hiding actual error
    ... You caused another exception inside your ensure clause, ... problems with handling correctly the original exception. ... IIRC initially this was about a syntax error. ...
    (comp.lang.ruby)
  • Re: Exception Handling - help!
    ... filter, the filter is indeed considered to have returned ... finally/fault will continue executing after the nested exception is caught. ... | when the 2nd exception reaches in the filter of the original exception, ...
    (microsoft.public.dotnet.framework.clr)
  • Re: Exception handling best practices
    ... > sensitive information in the original exception that you do not want ... You are right but we started our project with using ApplicationException as ... the original exception message than my own ...
    (microsoft.public.dotnet.general)

Loading