Creating the Service Proxy
To communicate with this service, your Avalon client will use a service proxy. This proxy needs to be generated based on the WSDL of the service. If you browse to the Service.svc file in the Web site, you'll see the address of the WSDL at the top of the screen (see Figure 2
Generating a proxy is very straightforward use the svcutil.exe tool that comes as part of the WinFX SDK. You can find this tool in the C:\Program Files\Microsoft SDKs\Windows\v1.0\Bin directory. It's a good idea to add that to your path.
When you run svcutil.exe, passing it the WSDL URI as a parameter, it generates two files.
The first is called output.config. This contains the configuration information needed by the service model (the heart of WCF) to set up the communications pipeline. You should copy and paste the content of this file into your App.config file. Here's what it looks like:
<?xml version="1.0" encoding="utf-8"?>
contract="IAdwService" name="default" />
The preceding XML configures the <system.ServiceModel> node, setting up a bindingthis is how WCF creates the communications channel. It also configures the client communication, defining which binding it should use, and the underlying endpoint for the service that it will talk to.
The second file that svcutil.exe creates is called output.cs, which is the proxy implementation. This manages all the communication on your behalf. You simply create an instance of it in your client and call the operation contracts it exposes as local methods. If you're familiar with consuming Web services in C#, this works in exactly the same way.