Search code examples
ajaxwcfjsonwcf-binding

How to create a WCF reply service for AJAX unit testing


I want to create a WCF service that will simply reply back the query string, HTTP headers, and the HTTP verb used in a request it received.

I want to use it to unittest a AJAX enabled JavaScript framework I am building so I can verify that the HTTP headers and HTTP verbs are being set correctly.

Basically I need a way to make the WCF service bind to HTTP GET, POST, PUT, and DELETE, and I need a way to grab all the headers etc. and return them.

Any input is much appreciated, Egil.


Solution

  • It turns out a HTTP handler was an easier way to go than a WCF service. I posted my solution over at my blog: Simple Ping/Reply Service for Unit Testing AJAX/XHR requests. I hope this helps others as well.