Connecting Tech Pros Worldwide Forums | Help | Site Map

howto get exception information from asp.net webservice, without try and catch

dan
Guest
 
Posts: n/a
#1: Nov 19 '05
hi ng.

i have a asp.net application which is client of an asp.net webservice.
now i want to configure a custom error page (in case the sewrvice throws an
exception)
that provides the soapexception detail property as text.
but when defined in web.config, the error page doesn't provide access to the
thrown exception anymore.
i think that i somehow have to enter the http pipeline to catch the error,
read the data and transfer to a error page. is this right?
but i have no cue where to begin and what excactly i have to look for.

what i have been reseaching was the soapextension class where it was
possible to intervene the incoming soap fault.
but i couldn't avoid the exception to get thrown.
(of course i do not want to set up a try-catch solution)

thank you very much for your help,
dan



Brock Allen
Guest
 
Posts: n/a
#2: Nov 19 '05

re: howto get exception information from asp.net webservice, without try and catch


If your webservice is failing, then you shouldn't show a HTML page to the
user. Typically the client of your webservice is not a human, so passing
back HTML makes little sense. The SOAP protocol includes error handing with
SoapFaults, so you should let the web service framework map the error on
your side to the SoapFault back to the client.

-Brock
DevelopMentor
http://staff.develop.com/ballen


[color=blue]
> hi ng.
>
> i have a asp.net application which is client of an asp.net webservice.
> now i want to configure a custom error page (in case the sewrvice
> throws an
> exception)
> that provides the soapexception detail property as text.
> but when defined in web.config, the error page doesn't provide access
> to the
> thrown exception anymore.
> i think that i somehow have to enter the http pipeline to catch the
> error,
> read the data and transfer to a error page. is this right?
> but i have no cue where to begin and what excactly i have to look
> for.
> what i have been reseaching was the soapextension class where it was
> possible to intervene the incoming soap fault.
> but i couldn't avoid the exception to get thrown.
> (of course i do not want to set up a try-catch solution)
> thank you very much for your help,
> dan[/color]



dan
Guest
 
Posts: n/a
#3: Nov 19 '05

re: howto get exception information from asp.net webservice, without try and catch


hi brock,

the webservices provides a fault message. and as my client is a dotnet
client (a asp.net website), a saopexception gets generated from this fault
message.
what i want to do is to provide some information from the
soapexception.Detail property (which is set on serviceside when the
exception occurs ) to a standard error side that is invoked when a
soapaexception occurs.

example:

serviceside:
definition of node

SoapException se = new SoapException("Concurrency
eroor",SoapException.ClientFaultCode,"",node);

throw se;


->i have to throw a soapexception because otherwise, i don't get information
about the exception on client side (inner exception property of
soapexception is null!)

clientside:
try....

catch(System.Web.Services.Protocols.SoapException ex)

{

System.Xml.XmlNode node=ex.Detail;

foreach(System.Xml.XmlNode nod in node.ChildNodes)

{

string s=nod.InnerText;

s="";

}



dan




"Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message
news:791648632525345991278008@msnews.microsoft.com ...[color=blue]
> If your webservice is failing, then you shouldn't show a HTML page to the
> user. Typically the client of your webservice is not a human, so passing
> back HTML makes little sense. The SOAP protocol includes error handing
> with SoapFaults, so you should let the web service framework map the error
> on your side to the SoapFault back to the client.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>
>[color=green]
>> hi ng.
>>
>> i have a asp.net application which is client of an asp.net webservice.
>> now i want to configure a custom error page (in case the sewrvice
>> throws an
>> exception)
>> that provides the soapexception detail property as text.
>> but when defined in web.config, the error page doesn't provide access
>> to the
>> thrown exception anymore.
>> i think that i somehow have to enter the http pipeline to catch the
>> error,
>> read the data and transfer to a error page. is this right?
>> but i have no cue where to begin and what excactly i have to look
>> for.
>> what i have been reseaching was the soapextension class where it was
>> possible to intervene the incoming soap fault.
>> but i couldn't avoid the exception to get thrown.
>> (of course i do not want to set up a try-catch solution)
>> thank you very much for your help,
>> dan[/color]
>
>
>[/color]


Closed Thread