Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm cannot recall how I found stumbled across Message Inspectors, but that it how I solved my problem.</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa717047.aspx" rel="nofollow noreferrer">This</a> and <a href="http://blogs.msdn.com/kaevans/archive/2008/01/08/modify-message-content-with-wcf.aspx" rel="nofollow noreferrer">this</a> article provided the base for creating the inspector, and what follows is the meat of the inspector:</p> <pre> public void AfterReceiveReply(ref Message reply, object correlationState) { if (!reply.IsFault) return; var document = new XmlDocument(); document.Load(reply.GetReaderAtBodyContents()); var navigator = document.CreateNavigator(); var manager = new XmlNamespaceManager(navigator.NameTable); manager.AddNamespace("soap", "http://schemas.xmlsoap.org/soap/envelope/"); var it = navigator.Select("//soap:Fault", manager); if (it.MoveNext() && it.Current.HasChildren && it.Current.MoveToChild(XPathNodeType.Element)) { do { var c = it.Current; if (string.IsNullOrEmpty(c.Prefix)) continue; c.ReplaceSelf("&lt;" + c.LocalName + "&gt;" + c.InnerXml + "&lt;/" + c.LocalName + "&gt;"); /// we may want to record the detail included inside the detail element, /// it is not reported in the FaultException that is raised. } while (it.Current.MoveToNext()); } var reader = XmlDictionaryReader.CreateDictionaryReader(new XmlNodeReader(document)); reader.MoveToStartElement(); var fixedReply = Message.CreateMessage(reply.Version, null, reader); fixedReply.Headers.CopyHeadersFrom(reply.Headers); fixedReply.Properties.CopyProperties(reply.Properties); reply = fixedReply; } </pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload