1

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.

1
  • Id love to see a server thats down respond with Server Down Commented Nov 18, 2011 at 9:30

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

unfortunately client server supports .net 2.0 only, that's why i have to use asmx.
@SaQiB, only suggestion that I have is that perhaps you should attempt to educate and convince your client to upgrade from .NET 2.0 (mainstream support ended in Apr 2011). Further, run-time version for .NET 3.0 & 3.5 both remains same at 2.0 - so upgrading is a quite risk-free. Essentially, there are only bug-fixes to core libraries in 3.5 and unless your code exploits those bugs, you will be safe!
+1 for your comment. yes i've already communicated to client that upgrade is necessary :-), till the i have started development of this web service in wcf. i'll get back if i encounter any problem in this solution
1

You should add FaultContract attributes with exception information to your method heads

3 Comments

thank, it helped a bit but looks like this is in .net framework 4.0 not 2.0? am i right.
but i need the solution in 2.0 :-(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.