.Net 4. View consumed web service headers and body from request and response

We're consuming a web service (web reference, not service reference), and I need a way to output the entire message being sent (including headers) and the message that gets received.

When I add the web reference, the generated base type of the client object to send the messages is System.Web.Services.Protocols.SoapHttpClientProtocol

I send the messages like so:

ApiService api = new ApiService();
// set the certificate and basic http network credentials

var response = api.SendRequest(messageObject);

I'm able to get the body of the request by serializing messageObject, but can't figure out how to get the full message with the headers.

Since I'm using a certificate and basic authentication, tools like Fiddler, etc. aren't getting me what I need, so I believe I have do something programmatically to pull whats sent and whats received prior to being encrypted with ssl.


What I want to see if the data being sent and received to another service from within my WCF service.... e.g.:

// this function is within my WCF service
public ResponseModel Auth()
    // call to another service here... need to trace this


If this is for tracing purposes I have had some success using the tracing capabilities of the System.Net libraries, you should be able to enable the tracing through configuration only.

It's described here: How to: Configure Network Tracing

The resulting log file isn't the easiest to follow, but is described here: Interpreting Network Tracing

Need Your Help

document.width - IE Bug

javascript jquery internet-explorer-8

I am trying to set the width and height of a mask behind a modal window.

Using has_many method in an ActiveResource object to relate to local ActiveRecord objects?

ruby ruby-on-rails-3 activeresource

I want to use an ActiveResource object to map Users from a service but I have local data that I want to associate with these Users

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.