Recently, I have worked with WCF. During this , I have developed one tool that help us to run any web service (.asmx) and wcf service (.svc) by just using URL of it. It was totally dynamic process. In this process, I have learn how to fetch method list , parameter names and how to invoke method dynamically. During this process I came across the terms called ServiceDescriptionImporter and ServiceContractGenerator. So I feel that I should share what these terms means and difference between them with my readers. so here it goes…
The ServiceDescriptionImporter class allows you to easily import the information contained in a WSDL description into a System.CodeDom.CodeCompileUnit object.
By adjusting the value of the Style parameter, you can instruct a ServiceDescriptionImporter instance either to generate a client proxy class that provides the functionality of the Web service by transparently calling it or to generate an abstract class that encapsulates the functionality of the Web service without implementing it.
The code in the resulting CodeCompileUnit object can then either be called directly or exported in the language of your choice.
The System.ServiceModel.Description.ServiceContractGenerator type generates service contract code and binding configurations from System.ServiceModel.Description.ServiceEndpoint description objects.
ServiceContractGenerator vs ServiceDescriptionImporter:
–>ServiceDescriptionImporter is the class that is used by the “Add Web Reference” dialog in VS and the “wsdl.exe” tool in the SDK to generate “asmx” style client web service proxies.
ServiceContractGenerator is the WCF equivalent, for the “Add Service Reference” dialog in VS and the “svcutil.exe” tool in the SDK.
–> ServiceDescriptionImporter uses the asmx client infrastructure (System.Web.Services.Protocols.SoapHttpClientProtocol and friends).
ServiceContractGenerator uses the WCF client infrastructure (System.ServiceModel.ClientBase and friends).
Hope this will help !!!