Eric,
I think the service wrapper your described is a better approach than
what I am using. I wonder though, will the error scenario I described
work any differently with the wrapper around the service?
Thanks,
Mike
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Eric Knipp
Sent: Wednesday, February 21, 2007 3:28 PM
To: Dallas/Fort Worth ColdFusion User Group Mailing List
Subject: Re: [DFW CFUG] Error handling in web services
Mike,
This may not be what you're looking for but I can tell you about an
approach we've used to work around the generally poor error handling in
ColdFusion web services. (Note that I don't have experience developing
web services in other languages, so I can't speak to whether or not CF
web service error handling is any better or worse than any other
platform).
Rather than consuming business objects directly as web services,
consider exposing as a service an interface wrapper which handles
lower-level communication with business objects. The wrapper has a
simple interface, using structures for passing parameters and control
information. The structure might include a key specifying the object
and method name to be invoked, or maybe you'd pass a key value that maps
to an object/method pairing in your model, if you need additional
abstraction.
The wrapper handles all instantiation and interaction with your business
objects; this effectively decouples the consumer logic from your
business model, freeing you from future integration concerns when your
business model must change. Additionally, the wrapper can be used to
trap any errors that occur during instantiation of business objects
(something that you CANNOT do when talking directly to a business object
which has been "web service-fied"), potentially logging or passing the
errors back up through the stack. Let me tell you, its a lot nicer to
get a well-formatted ColdFusion error including stack trace, line
number, etc, when instantiation of a business object fails.
Once you've built your base wrapper you can easily extend it to include
caching of business objects, ColdSpring integration for dependency
injection, etc. It really simplifies the architecture to have a single
point of contact with the web services layer.
In my experience, the hardest part of working with ColdFusion web
services is the interfacing. Once you have developed a robust wrapper
object as a service layer, you can count on spending very little time
tinkering with integration going forward, instead dealing with the
complexities of the business model.
Hope that helps.
Best,
Eric
On 2/21/07, Ferris, Mike <[EMAIL PROTECTED]> wrote:
All,
How does CF 7.02 handle errors in web services you publish?
I am adding error handling to log and notify me of anything that
I haven't already caught with cftry/catch. I put an onError function in
my application.cfc. When I test my error handling by calling the .cfc
as a component, it works great. The onError logs the error and sends me
an email.
When I test using a .Net app and call the .cfc as a web service,
something besides my onError seems to catch the error. It returns
"coldfusion.xml.rpc.CFCInvocationException:
[coldfusion.runtime.UndefinedVariableException : Variable apple is
undefined.]" (I am trying to add 1 to apple (which is not defined) as
my test).
Whatever this mysterious handler is correctly identifies the
error. But, it is not calling my routines to log and email me.
Anyone have a clue how to catch errors in this scenario???
Thanks,
Mike
CONFIDENTIALITY NOTICE: The information contained in this e-mail
and attached document(s) may contain confidential information that is
intended only for the addressee(s). If you are not the intended
recipient, you are hereby advised that any disclosure, copying,
distribution or the taking of any action in reliance upon the
information is prohibited. If you have received this e-mail in error,
please immediately notify the sender and delete it from your system.
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
<http://www.mail-archive.com/list%40dfwcfug.org/>
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/ <http://www.teksystems.com/>
CONFIDENTIALITY NOTICE: The information contained in this e-mail and attached
document(s) may contain confidential information that is intended only for the
addressee(s). If you are not the intended recipient, you are hereby advised
that any disclosure, copying, distribution or the taking of any action in
reliance upon the information is prohibited. If you have received this e-mail
in error, please immediately notify the sender and delete it from your system._______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/