I'm using the Enterprise Library Validation Application Block for my WCF service. All is fine, and .Net consumers can catch the FaultException<ValidationFault>
exception to get a collection of human-readable business errors. However, it doesn't look quite as great for non-.Net consumers, especially those that are going to be looking at the raw SOAP message. The SOAP Reason text is always "The creator of this fault did not specify a Reason." This isn't very helpful, as there is a reason, it's specified under the <Detail>
element, as shown in the example Fault message below.
Is there any way to change the text "The creator of this fault did not specify a Reason." to something more helpful like "See ValidationFault Details"?
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-GB">The creator of this fault did not specify a Reason.</s:Text>
</s:Reason>
<s:Detail>
<ValidationFault xmlns="http://www.microsoft.com/practices/EnterpriseLibrary/2007/01/wcf/validation" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Details xmlns:b="http://schemas.datacontract.org/2004/07/Microsoft.Practices.EnterpriseLibrary.Validation.Integration.WCF">
<b:ValidationDetail>
<b:Key i:nil="true"/>
<b:Message>Value Validator</b:Message>
<b:Tag>request</b:Tag>
</b:ValidationDetail>
</Details>
</ValidationFault>
</s:Detail>
</s:Fault>
</s:Body>