Jason Rowe

Be curious! Choose your own adventure.

Testing WCF Soap Messages Using Fiddler

The following is how I generate test soap requests for .Net WCF services and work with them in Fiddler. This comes in handy when I want to see how the service is responding to HTTP header changes. The great thing is once you get the request into Fiddler you can change the request body or header and send it again.

First thing you need is a sample request. The easiest way for me is to use the WCF Test Client configured to point at Fiddler proxy. You can do this pretty quickly.

Run WCF Test Client (“C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\WcfTestClient.exe”). Right click on the My Service and click Add Service. Put your service URL in the text box and click OK.

Hopefully you have at least one method that doesn’t have an exclamation mark next to it (the exclamation mark means you have too complicated of a request object for the test client) that you can use to generate a request. You should also have a Config File listed at the bottom below all the method names.

Right click on Config File and select Edit with SvcConfigEditor. Open the Client folder and then continue to drill into the Endpoints folder and double click on “BasicHttpbinding…” and change the endpoint to include port 8888. This is the default port Fiddler will listen on. Close the window and save your changes when prompted.

Now we are ready to capture some traffic and make a request. Open Fiddler and then make a request from the WCF Test client for one of your methods. You can do this by double clicking on the method name and filling in any needed parameters. Objects can be created by clicking on the Null and selecting them in the drop down if needed. Then just click the invoke button.

You should see the request come through in Fiddler. Click the Composer tab to the right and drag that HTTP request over to populate all the data.

Using the composer you can change the request body, request headers, and HTTP method. Once ready, click the execute button and get your results.


Posted

in

,

by

Tags:

Comments

7 responses to “Testing WCF Soap Messages Using Fiddler”

  1. Prathyusha Avatar
    Prathyusha

    Thanks a lot!!!. I was really struggling to write a Raw Soap request. This really helped me debug my issue.

  2. Big Fan Avatar
    Big Fan

    So nice article. You saved me so much agony and wasted time. Thank you!

  3. Paul Klanderud Avatar
    Paul Klanderud

    Thanks Jason! Searched on “fiddler” and “test wcf” and your blog came in at the top of the search results!

  4. Felipe Rafful Avatar
    Felipe Rafful

    Thanks man!

  5. Robert Pernett Avatar
    Robert Pernett

    Thanks! Great tip! I’ve always wondered how to get fiddler to be more a part of my dev/test routine.

  6. Sonny Avatar

    Thanks for the tip! It looks like you do not have to change the port binding anymore with the latest version of Fiddler 4. It seems to capture all the outgoing traffic calls.

  7. Jason Avatar
    Jason

    Cool, good to know they made this easier.

Leave a Reply

Your email address will not be published. Required fields are marked *