February 6, 2006
@ 11:27 PM

In one of the discussions  on the MSDN Architecture Forum someone  mentioned that when a service invocation results in  an exception his company standard is to:

 

  • Log the error before exiting the service

  • Create a new SOAP error (exception) with minimal info ("The requested service failed") and that error includes (innerException) the original error (This way, if someone receives my error and they are not familiar with my errors - they will get a simple soap error. If they are familiar with my error, they will have the ability to inspect it further)

 

I think this is this is the very distinct  anti-pattern of how to do SOA i

Lets look at few reasons why:

  1. Log the error - that is fine and everything - maybe it'll help during the post mortem, but the operations people should also be notified somehow. Otherwise you have a dead service there and no one knows

  2. "exiting the service"  - Services shouldn't fail - a failed service can mean a lost business opportunity.   When  you can't service the requests, you should at least be able to maintain the "well know end-point" up and running and let everyone know that the service is, well, "out of service - be back in XYZ". The preferable solution is to still  be able to queue incoming  requests and handle them later (this may not be possible if part of the policy (or SLA) for the service is to react within few seconds, but again, in many other circumstances it is very plausible.

  3. SOAP Exception - why through a SOAP exception - the protocol/communication worked fine...

  4. "...(innerException) the original error" - do not expose internal implementation out side of the service - only what's in the contract - in other words don't, just don't bubble exceptions out of your service.

 

It is very easy to make, what seems like, a small concession on the purity of your service, but your SOA concept and loose coupling specifically can deteriorate very rapidly on even the smallest compromises


 
Wednesday, February 08, 2006 8:30:39 PM (GMT Standard Time, UTC+00:00)
As the person who wrote that I can only say one thing - you are so very right !

I originally thought of what to write and how to explain why I did what I did, but let's face it - everything I'll write will be just a lot of excuses because that's what it is - an ad-hoc architectural solution for a set of requirements in a limited time period. Hopefully one day (a couple of months) I will be able to change all of that

But set excuses aside - everything you said is correct :
- service should notify someone if they fail - preferably the help desk (or at the least some kind of a MOM system)
- services must always return a value - preferably an enum of success+possible errors+unknown error (I've discussed it a bit in the forum when I expressed my opinion that this architecture pattern should have been implemented as a framework a long time ago)
- Soap Exception - I'll agree with a distinction - if it should throw a soap exception, why does MS always throws a soap exception when a service fails ?
- InnerException - totally agree it shouldn't pass outside (I've also discussed that in the forum in regard to a need for a logging system that can return a log code to the client so he can query the help desk regarding his problem with the service)
Ido F.
Thursday, January 11, 2007 8:47:31 PM (GMT Standard Time, UTC+00:00)
You are right - it is important to make information available for the operation people.
I work as a developer - right now we are trying out a new beta product called UptoLog, which makes it possible to log errors in one central database and quickly search trough all the error logs. Of curse developers have match use of UptoLog when error situations occur. The surprising discovery is that the operation people also benefit from the system.
If you are curious you can find UptoLog at UptoLog.com
Bill Roberts
Comments are closed.