Re: Custom SoapFilter for WSE 3 and Exceptions



Hello Steven,

I'm sorry about the inability to catch original exception inside WSE filter,
but custom SOAP extension will do the job.

Thank you for the complete and helpful answer.

Stephan Zahariev

"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:XjqwuxfPHHA.2304@xxxxxxxxxxxxxxxxxxxxxxxxx
Hello Stephan,

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?

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.

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).

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:


#User Friendly ASP.NET Exception Handling
http://www.codeproject.com/aspnet/ASPNETExceptionHandling.asp

#Exception Injection Using a Custom SOAP Extension
http://haacked.com/archive/2005/06/29/ExceptionInjectionUsingCustomSoapExten
sion.aspx


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.

Hope this helps some. If you have anything unclear on this, please feel
free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



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.

==================================================



This posting is provided "AS IS" with no warranties, and confers no
rights.


.



Relevant Pages

  • 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: Custom SoapFilter for WSE 3 and Exceptions
    ... \par #Exception Injection Using a Custom SOAP Extension ... \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. ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • 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