Tuesday, March 29, 2011

WCF : Testing your web service

Back in the day (before WCF), you could use "Web Service Studio". This was a web service client tool that could import your web service's WSDL and allow you to test the service's methods without having to roll your own test client.

However, this doesn't work with WCF. It imports the WSDL no problem but doesn't show any methods to test.

You can also direct your browser to the web service e.g.


and you get a test page starting "You have created a service".

It shows you how to run svcutil on the command line e.g.

svcutil.exe http://localhost:8000/ServiceModelSamples/Service?wsdl

"This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service."

But - roll of drums and enter stage left Windows Communication Foundation (WCF) Test Client (WcfTestClient.exe)

"You can also invoke the WCF Test Client (WcfTestClient.exe) outside Visual Studio to test an arbitrary service on the Internet. To locate the tool, go to the following location:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ "

Very neat!


1 comment:

brother inkjet said...

Oh I see! Thanks for sharing I'll do some test later.