Here is quick and dirty way of logging raw SOAP messages before they go out to the server.

Create class that implements IClientMessageInspector

public class SimpleMessageInspector : IClientMessageInspector  
{
    private readonly StreamWriter _streamWriter;

    public SimpleMessageInspector(StreamWriter streamWriter)
    {
        _streamWriter = streamWriter;
    }

    public void AfterReceiveReply(ref System.ServiceModel.Channels.Message reply, object correlationState)
    {
    }

    public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, IClientChannel channel)
    {
        _streamWriter.WriteLine(request.ToString());
        return null;
    }
}

`

Create endpoint behavior

class MessageInspectorBehavior : IEndpointBehavior  
{
    private readonly StreamWriter _streamWriter;

    public MessageInspectorBehavior(StreamWriter streamWriter)
    {
        _streamWriter = streamWriter;
    }

    public void Validate(ServiceEndpoint endpoint)
    {
    }

    public void AddBindingParameters(ServiceEndpoint endpoint, BindingParameterCollection bindingParameters)
    {
    }

    public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
    {
    }

    public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
    {
        var inspector = new SimpleMessageInspector(_streamWriter);
        clientRuntime.MessageInspectors.Add(inspector);
    }
}

Add behavior to the client

var client = new MyServiceProxy.ApplicationClient();  
var streamWriter = new StreamWriter("ClientLog.txt");  
try  
{
    client.Endpoint.Behaviors.Add(new MessageInspectorBehavior(streamWriter));
    var response = client.GetFoo();
}
finally  
{
    streamWriter.Close();
    client.Close();
}

This writes out raw SOAP message like that:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">  
  <s:Header>
    <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">Heartbeat</Action>
  </s:Header>
  <s:Body>
    <!-- stuff -->
  </s:Body>
</s:Envelope>