I developed a asp.net 2.0 web service (.asmx), now my client said that
“there is no fault exception available. It contains only request and
response. We need to handle the exception scenarios while we are
calling the webservice, Could you please update the WSDL on fault
exception and send back the updated WSDL to us to proceed with the
Client stubs.Webservice Response should have the below mentioned error code for the
failure cases from the webservice as mentioned below :Error code: Error Information 002 Server Down 003 Invalid Input Format
etc.
I am not sure how can i update my code so that the “fault exception” tags are generated in asmx wsdl file & how should i throw such exception.
Any help/suggestion please or please let me know if you need further explanation.
AFAIK, ASP.NET web services (asmx) does not support custom soap faults. On a different note, it’s considered as legacy technology (by Microsoft) – there is no point in developing new services in it.
Use WCF services (that are more flexible in all manners) – see this simple tutorial to get started with WCF.
Coming to your question, WCF support custom soap fault (known as fault contract in WCF lingo) – see this simple tutorial for adding fault contract to a WCF service.