468,249 Members | 1,485 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,249 developers. It's quick & easy.

web service custom exceptions: SoapException.InnerException

http://msdn2.microsoft.com/en-us/library/ds492xtk.aspx

Is this the following excerpt from the above page incorrect, or is there a
bug in the .net 2.0 implementation? Or perhaps I have something configured
wrong. Basically, the doc says that when a custom exception type is thrown
from a web method, that the web service client app will receive a
soapexception with the soapexception.InnerException property set to reference
the custom exception. I aways get a null value, however (the .message
property does contain a merge of the soapexception message and my custom
exception message, however): The doc says:

When unhandled exception occurs: While executing the Web service method

What ASP.NET does: The exception is caught by ASP.NET and thrown back to the
client. The Web service client created using the .NET Framework receives a
SoapException with the specific exception placed in the InnerException
property

Any ideas on what is right (code or doc?) Thanks!
Mar 10 '06 #1
4 8179
Hi Asanford,

Welcome to MSDN newsgroup.

As for hte MSDN doc you mentioned, I've viewed it and it still remains the
same with the one for 1.1:

[2.0]
http://msdn2.microsoft.com/en-us/library/ds492xtk.aspx

[1.1]
http://msdn.microsoft.com/library/en...lingRaisingExc
eptionsInXMLWebServices.asp?frame=true

And for the "InnerException" property of the SoapException class, it is
used only when the exception is not captured within the webmethod, as
mentioned by the following statement:

"Exceptions Not Handled by an XML Web Service Method"

In another world, for general webservice's webmethod, when there occur an
exception and been throwed to clientside, the generated SoapException won't
contains InnerException info. Detailed exception info or customized
exception info should be stored in the SoapException.Detail property(an
xmlNode). You can see the example on use the Detail property in the 1.1
doc:

http://msdn.microsoft.com/library/en...lingRaisingExc
eptionsInXMLWebServices.asp?frame=true

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Mar 13 '06 #2
Hi Asanford,

Does my last message helps you a little on this question? If there's
anything else we can help, please feel free to post here.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Mar 15 '06 #3
Hi, Steven,

Thanks for your response. Unfortunately, your reply doesn't clarify the
situation in my mind. It still seems the code doesn't agree with the
documentation. Can you clarify? One part of the doc says that if I throw an
exception, asp.net generates a soapexception and no indication is given as to
how innerexception is set or not set. Later, it says that if an exception is
unhanded in the web method, that a soapexception is created and the
innerexception set. But, I don't see the inner exception set. Maybe the
problem turns on what the doc means by an unhandled exception occurring in a
web method. To me, that could include the case where my web method generates
an exception, but does not catch it - and so it should go on to the client.
The doc says in this case the innerexception is set, but I've observed
otherwise.

thanks,
-A

"Steven Cheng[MSFT]" wrote:
Hi Asanford,

Welcome to MSDN newsgroup.

As for hte MSDN doc you mentioned, I've viewed it and it still remains the
same with the one for 1.1:

[2.0]
http://msdn2.microsoft.com/en-us/library/ds492xtk.aspx

[1.1]
http://msdn.microsoft.com/library/en...lingRaisingExc
eptionsInXMLWebServices.asp?frame=true

And for the "InnerException" property of the SoapException class, it is
used only when the exception is not captured within the webmethod, as
mentioned by the following statement:

"Exceptions Not Handled by an XML Web Service Method"

In another world, for general webservice's webmethod, when there occur an
exception and been throwed to clientside, the generated SoapException won't
contains InnerException info. Detailed exception info or customized
exception info should be stored in the SoapException.Detail property(an
xmlNode). You can see the example on use the Detail property in the 1.1
doc:

http://msdn.microsoft.com/library/en...lingRaisingExc
eptionsInXMLWebServices.asp?frame=true

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights

Mar 16 '06 #4
Thanks for response Asanford,

IMO, any webservice, webmethod specific exceptions should not utilize the
InnerException, so our client application should also not rely on that. I
think inner exception will be used only when the exception is thrown by the
.net framework or ASP.NET runtime which is out of the scope of webservice
engine. Anyway, in our client side code, we can first check the inner
exception, if it exists, we can pick up some further info form it.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Mar 20 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Marty McDonald | last post: by
1 post views Thread by Vinoth Kumar | last post: by
2 posts views Thread by Anthony Biondo Jr | last post: by
3 posts views Thread by Tomsawyer2kin_hotmail | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by kermitthefrogpy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.