Previously, I posted about my
problem getting the WCF Test Client tool to work. Well, it works now
on my new machine. The solution is, as I noted in the update to that
post, that I need the 6.0a SDK (the one that comes with Visual Studio
2008), not the 6.1 SDK. Go figure.
Anyway, here are my notes on getting it all to work...
Step
1: go to the command line and execute wcftestclient.exe passing the URL
to the WCF service you want to test (Note: if your service will be
running under the ASP.NET Development Server, make
sure that's running first before you try to run the test tool):
Step
2: after a few minutes, WCF Test Client will use svcutil.exe to generate a
client proxy and display a UI that lets you test the various methods of
your service:
Limitations I've noted:
- I'm
doing a lot of work with custom bindings and, on occasion, custom
binding and behavior extensions. Svcutil does not appear to generate a
complete client config file under some of these circumstances. I've
written my own test clients, used svcutil to generate my proxy and
config file, and still had to go in and copy/paste configuration
settings from my service to my client to get the client to work
successfully. In these situations, I would say forget WCF Test Client
and write your own. I've not tried WCF Test Client with custom
extensions, but I would imagine that, assuming svcutil can generate a
correct config file to begin with, you'd have to copy your custom
assemblies next to wcftestclient.exe so that it could use those
extensions.
- Can you edit the client config generated by
WCF Test Client? Interestingly, the tool lets you see the config right
in the UI and will easily give you the file path to where it saved out
the config, but I haven't been able to edit it and see that the tool
discovers those changes. So, no copy/pasting xml from your service
config to your client config to make up for the misses on the part of
svcutil. (Not that I mean to disparage svcutil or anything--it's a
great tool and one that I would certainly miss if it were to suddenly
disappear.)
- I've also had situations where I've had to go
in and modify the proxy class that svcutil generated for me.
Specifically, I've had a situation where my requirement was to provide
a signed, but cleartext, response message. By default, WCF will
transmit a signed and encrypted message body. To change this behavior,
you have to go into your proxy class and set the ProtectionLevel
attribute accordingly.
Unfortunately, there appears to be no way to edit the proxy class used
by the WCF Test Client for these kinds of situations--so, back to
rolling your own test client. For most mainstream scenarios, though,
the test client seems to do the job.