The Artima Developer Community
Sponsored Link

.NET Buzz Forum
SOA, Web Services, and Exceptions

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Avery

Posts: 1206
Nickname: james615
Registered: Sep, 2003

James Avery is a .NET pimp
SOA, Web Services, and Exceptions Posted: Feb 10, 2004 8:36 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by James Avery.
Original Post: SOA, Web Services, and Exceptions
Feed Title: .Avery Blog
Feed URL: /blog/Install/BlogNotConfiguredError.aspx
Feed Description: .NET and everything nice
Latest .NET Buzz Posts
Latest .NET Buzz Posts by James Avery
Latest Posts From .Avery Blog

Advertisement

Ryan Rinaldi asks the question of how exceptions should be handled in a service oriented architecture, his solution is to return a status code but also complains that is feels way too much like HRESULT. So is there an alternative?

Not really. When you look at dealing with exceptions across a web service you have to keep the primary goal of web services in mind, which is enabling loosely coupled systems. Keeping this primary goal in mind means that we need to throw an exception that is XML and its probably a good idea to be at least partly human readable (I would want to include a message AND an ID, not just an ID), the SOAP specification handles this with the SOAP Fault.

.NET accommodates the SOAP fault with the SoapException which creates a SOAP fault (<fault> element) automatically for you based on the .NET exception that you threw inside your application. You can also create a SoapException on your own and use the detail element to add any sort of extra information to the SoapException, this is where you can put your exception code or other special information about your exception. (You could even serialize your exception using binary serialization and stick it in the detail element if you really wanted to, but then what's the point of using XML)

So basically in the end I think you do need to use some sort of error code instead manually parsing a string, but by creating your own SoapException you can use the detail element to put it in the right place. Learn about the soap fault and the SoapException, don't just let .NET hide it all from you.

Does anyone else have any ideas/opinions on this? Am I missing something?

Here is a little extra reading:

Handling and Throwing Exceptions in XML Web Services - MSDN

Framework Patterns: Exception Handling, Logging, and Tracing - informIT

-James

Read: SOA, Web Services, and Exceptions

Topic: Users Can't Know Their Requirements Early Previous Topic   Next Topic Topic: Xbox Live 3.0

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use