On Thu, Mar 24, 2005 at 06:27:38PM -0000, Sebastien Boving & Nicole Kersting scratched on the wall:
> Is it possible to throw (Error.pm-style) exceptions on the
> server-side, and catch these on the client-side? And how ;)?
Sort of. SOAP has the concept of a "Fault" that indicates a
operational error. Actually, you can use them for anything, but
they're usually used to indicate an operational error (e.g. "cannot
connect to database") rather than a functional one (e.g. "no rows to
return"). There are some broad categories (like "Client" fault, e.g.
illegal function name, or "Server", e.g. Database down), but you can
extend the code to indicating a more specific error, e.g.
"Server.Database.CannotConect". You can also provide a
human-readable string. See SOAP::Fault for specifics.
You send one of these using "die" in any function handler:
if( $err )
-> faultcode( $SOAP::Constants::FAULT_CLIENT . 'AuthAuth' )
-> faultstring( 'Auth/Auth info is invalid.' );
Since all handlers are run under an exec( ), this acts like a thrown
> Moreover, if possible, will such Exceptions thrown on a SOAP::Lite
> server-side be possible to be caught by non-SOAP::Lite clients?
Yes. Since SOAP Faults are part of the spec, most clients allow you
to trap or detect a Fault in some way. PHP5, for example, throws an
exception if a function call results in a SOAP Fault, but each client
lib and/or language may deal with it differently.
Jay A. Kreibich | CommTech, Emrg Net Tech Svcs
| Campus IT & Edu Svcs
> | University of Illinois at U/C