HighTechTalks DotNet Forums  

stock stack trace from showing in soapexception

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss stock stack trace from showing in soapexception in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jeremy
 
Posts: n/a

Default stock stack trace from showing in soapexception - 12-12-2007 , 03:04 PM






I've written a web service, with a try catch in my web method. In the
catch, I create a new SoapException instance with a message of "Error Here".
Then I throw the SoapException. In my calling application I call the web
service inside a try catch. When I catch the SoapException, the message
property of the exception is "System.Web.Services.Protocols.SoapException:
Error Here at MyWebService.HandleException(Exception ex) at
MyWebService.MyWebMethod()"

When I throw the SoapException, why does it append the stack trace to the
message, and put "System.Web.Services.Protocols.SoapException: " at the
beginning of the message? Is it possible for me to tell it to retain the
actual message? All I want the calling application to see is the value I
put in the message property.




Reply With Quote
  #2  
Old   
Tiago Halm
 
Posts: n/a

Default Re: stock stack trace from showing in soapexception - 12-12-2007 , 06:57 PM






You need to suppress the exceptions. Add this to your web.config:

<webServices>
(...)
<diagnostics suppressReturningExceptions="true"/>
</webServices>

Tiago Halm

"Jeremy" <nospam (AT) please (DOT) com> wrote

Quote:
I've written a web service, with a try catch in my web method. In the
catch, I create a new SoapException instance with a message of "Error
Here". Then I throw the SoapException. In my calling application I call
the web service inside a try catch. When I catch the SoapException, the
message property of the exception is
"System.Web.Services.Protocols.SoapException: Error Here at
MyWebService.HandleException(Exception ex) at MyWebService.MyWebMethod()"

When I throw the SoapException, why does it append the stack trace to the
message, and put "System.Web.Services.Protocols.SoapException: " at the
beginning of the message? Is it possible for me to tell it to retain the
actual message? All I want the calling application to see is the value I
put in the message property.






Reply With Quote
  #3  
Old   
John Saunders [MVP]
 
Posts: n/a

Default Re: stock stack trace from showing in soapexception - 12-12-2007 , 08:08 PM



"Jeremy" <nospam (AT) please (DOT) com> wrote

Quote:
I've written a web service, with a try catch in my web method. In the
catch, I create a new SoapException instance with a message of "Error
Here". Then I throw the SoapException. In my calling application I call
the web service inside a try catch. When I catch the SoapException, the
message property of the exception is
"System.Web.Services.Protocols.SoapException: Error Here at
MyWebService.HandleException(Exception ex) at MyWebService.MyWebMethod()"

When I throw the SoapException, why does it append the stack trace to the
message, and put "System.Web.Services.Protocols.SoapException: " at the
beginning of the message? Is it possible for me to tell it to retain the
actual message? All I want the calling application to see is the value I
put in the message property.
You should experiment with the customErrors element in web.config. Either
"off" or "on" will work, whichever is opposite of what you currently have.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.