Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SOAPException message
Message
Information générale
Forum:
ASP.NET
Catégorie:
Web Services
Divers
Thread ID:
00910888
Message ID:
00912931
Vues:
41
Alexandre,

Actually, you can get only the message quite easily by turning off the ASP.Net error information. You're getting the stack walk information, but that's only returned to you if you RemoteErrors turned on in web.config and you're running locally. Turn the customErrors on and SoapException will return only the error message properly.

If you're debugging locally the default setting is RemoteOnly:
<?xml version="1.0"?>
<configuration>
  <system.web>
    <customErrors mode="RemoteOnly" />
  </system.web>
</configuration>
Change that to:
    <customErrors mode="On" />
And your Soap exceptions should come back with just the error message. If you're working with Web Services only tis shouldn't be a problem since you rarely will want to the whole stackwalk, but if you're also debugging ASP.net apps you probably will want to run with RemoteOnly anyway. Just realize that your final application will not see those long detailed error messages, but just the precise error. Whatever you do though, make sure that you capture all errors on the server and only throw SoapExceptions from there because regular exceptions won't pass the info forward the same way (if I remember right).


I started down the manual parsing crap myself only to find that once the whole thing went to production that wasn't necessary <g>...

+++ Rick ---


>Hello,
>
>I am calling some webservices and at some point in time, one of my WebService throws an exception (ApplicationException) with a specific message. I want to display the exception message in a DIV.
>
>The exception handler catches the exception but the string in the Message property of my exception contains too much information. It contains
>"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ApplicationException: Missing mandatory field(s). " and all the Stack Trace...
>
>Here's the code (pretty straightforward) :
>Dim objWS As MyWebService
>
>Try
>
> objWS = New MyWebService
> objWS.MyWebMethod()
>
>Catch ex As Exception
> divErrors.InnerText = ex.Message
>End Try
>
>I would like to display only my message "Missing mandatory field(s)"... Of course I could parse the string and look for "--->" but I guess there's a better solution out there.
>
>Thank you for your help,
> Alex
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform