R
Rachit Samwalla
Hi, I'm writing a fairly large web service and would like to be able to
pass more complex exceptions to the client to make things easier to
debug.
I understand that if you throw a SoapExecption() with the Detail field
populated with an XML node, this information gets passed to the client.
What I wish is to write a global wrapper for all my web service
functions that does the following:
try {
InvokeMethod();
} catch (SoapException e) {
// if its already a SoapException, just rethrow it.
throw e;
} catch (Exception e) {
// for all other exceptions, wrap it in a soap exception and
rethrow it.
// The wrapper will include things like line number of failures,
etc. in
// the Detail node.
throw new WrapperException(e);
}
What I cannot find is a place of putting this code such that I do not
have to change every single function in my WebService. Nothing to
override or anything. Only automated way I can think of is using a code
generator or mucking with the Emit library, which is less than ideal.
I'm sure others have faced this problem, but I have searched everywhere
and can't find anything.
Thanks!
pass more complex exceptions to the client to make things easier to
debug.
I understand that if you throw a SoapExecption() with the Detail field
populated with an XML node, this information gets passed to the client.
What I wish is to write a global wrapper for all my web service
functions that does the following:
try {
InvokeMethod();
} catch (SoapException e) {
// if its already a SoapException, just rethrow it.
throw e;
} catch (Exception e) {
// for all other exceptions, wrap it in a soap exception and
rethrow it.
// The wrapper will include things like line number of failures,
etc. in
// the Detail node.
throw new WrapperException(e);
}
What I cannot find is a place of putting this code such that I do not
have to change every single function in my WebService. Nothing to
override or anything. Only automated way I can think of is using a code
generator or mucking with the Emit library, which is less than ideal.
I'm sure others have faced this problem, but I have searched everywhere
and can't find anything.
Thanks!