c# - How to propagate an exception across SOAP Web Services? -
i have standard asmx web service. want throw custom exception , have caught on client side. thing ever comes across soapexception. example:
// server side code [webmethod] public void foo(string bar) { throw new customexception(bar); } public class customexception : exception { .... } // client side code public void callfoo() { try { service.foo() } catch (customexception ex) { console.writeline(ex.message); } catch (soapexception ex) { console.writeline("it hits here"); } catch (exception ex) { console.writeline(ex.message); } }
is there way send through customexception exception? serialize somehow perhaps?
according msdn:
'[...] exceptions thrown xml web service method thrown soapexception[...]', handling , throwing exceptions in xml web services.
that said, nothing prevents creating exception wrapper class , serialize it, @davogones suggested on post:
Comments
Post a Comment