Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In XML Web Services, what is the best practice for passing exceptions back to the client?

If my web method throws an exception, what is the best practice for passing that exception to the client?

like image 242
mcass20 Avatar asked Apr 28 '10 16:04

mcass20


1 Answers

  • In plain old asmx services by catching this exception and rethrowing a SoapException and filling the Detail property.
  • In WCF by throwing a FaultException<T>. As far as the catching is concerned a good place to do this is a custom IErrorHandler that would provide the appropriate fault to the client.
like image 124
Darin Dimitrov Avatar answered Oct 15 '22 15:10

Darin Dimitrov