SOAP Faults in WCF – Easy WCF
Skip to content

SOAP Faults in WCF

When an exception occurs in WCF service, the service serializes the exception into a SOAP fault and then send it to client.
By default unhandled exception details are not included in SOAP faults.A generic SOAP fault is returned to client
This is Continuation to ExceptionHandling in WCF.

SOAP faults are in XML format and are platform independent.
A SOAP fault contains:

  • FaultCode
  • FaultReason
  • Detail ELement etc..

SOAP format depends on the bindings.SOAP detail element can be used to include any custom xml.

To view SOAP fault message, enable message logging in WCF.How to do it is discussed in earlier discussions(part-8).
When you have not handled exception, you will see below SOAP fault in XML Message.

After adding the configuration,you will see below SOAP fault:

To view SOAP1.2 fault message, set binding to wsHttpBinding.By default the security mode is turned on for wsHttpBinding and we need to make it to None to view fault message.SO let’s change it in app config.

and

Then update the service reference in client and test the service.You will see below SOAP fault exception.

© 2015, admin. All rights reserved.

One thought on “SOAP Faults in WCF

  1. Pingback: WCF Interview Questions (Part -4) | Easy WCF

Leave a Reply

Your email address will not be published. Required fields are marked *