This is in response to a post on CodePlex in regards to how to retrieve the metadata of a service. I based this on a WCF Sample create by Vipul Modi.
In the WCF Test Harness solution, the DynamicProxyFactory class is used to generate a proxy class based on a metadata enabled service. The class performs the following:
- Downloads Metadata - uses the System.Web.Services.Discovery.DiscoveryClientProtocol to retrieve the metadata
- Imports Metadata - uses the System.ServiceModel.Description.WsdlImporter to extract the bindings, contracts and endpoints
- Creates Proxy - generates the proxy code
- Writes Proxy - writes the code into memory
- Compiles - compiles the proxy code into a temporary assembly
If you are interested in exploring this, I suggest retrieving the source code and investigating the classes located in the Dynamic folder of the Spike.ContractBuilder library.
Tue, Jan 20 2009 10:27 AM