private void processReply(System.ServiceModel.Channels.Message reply) { System.Diagnostics.Debug.Assert((reply != null)); if (reply.IsFault) { System.Xml.XmlDictionaryReader reader = reply.GetReaderAtBodyContents(); try { throw new CFFaultException(reader.ReadOuterXml()); } finally { reader.Close(); } } }
public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState) { MessageBuffer buffer = reply.CreateBufferedCopy(Int32.MaxValue); Message msgCopy = buffer.CreateMessage(); reply = buffer.CreateMessage(); // Get the SOAP XML content. string strMessage = buffer.CreateMessage().ToString(); // Get the SOAP XML body content. System.Xml.XmlDictionaryReader xrdr = msgCopy.GetReaderAtBodyContents(); string bodyData = xrdr.ReadOuterXml(); // Replace the body placeholder with the actual SOAP body. strMessage = strMessage.Replace("... stream ...", bodyData); List <object> results = new List <object> { string.Format("Received:\n{0}", strMessage) }; _logger.WriteLogEntry(results, "AfterReceiveReply", LogLevelType.Trace); }
public object AfterReceiveRequest(ref Message request, IClientChannel channel, InstanceContext instanceContext) { // Make a copy of the SOAP packet for viewing. MessageBuffer buffer = request.CreateBufferedCopy(Int32.MaxValue); Message msgCopy = buffer.CreateMessage(); request = buffer.CreateMessage(); // Get the SOAP XML content. string strMessage = buffer.CreateMessage().ToString(); // Get the SOAP XML body content. System.Xml.XmlDictionaryReader xrdr = msgCopy.GetReaderAtBodyContents(); string bodyData = xrdr.ReadOuterXml(); // Replace the body placeholder with the actual SOAP body. strMessage = strMessage.Replace("... stream ...", bodyData); // Display the SOAP XML. System.Diagnostics.Debug.WriteLine("Received:\n" + strMessage); return(null); }