views:

251

answers:

1

I'm trying to build a light-weight SOAP client without using Add Service Reference. Ideally, this client should work for as many services as possible. Currently, it uses ServiceDescriptionImporter to generate the service assembly. Unfortunately, this doesn't appear to work for WCF services. Someone recommended that I use ServiceContractGenerator instead, because ServiceDescriptionImporter is designed specifically for ASMX web services.

If I use ServiceContractGenerator, will I be locked into only supporting WCF services?

+3  A: 

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. The former uses the asmx client infrastructure (System.Web.Services.Protocols.SoapHttpClientProtocol and friends) and the latter uses the WCF client infrastructure (System.ServiceModel.ClientBase and friends).

Either will be able to talk to most services -- that is, it is intended for both the WCF and asmx client infrastructures to be broadly interoperable with a range of web services standards. A WCF client can talk to an asmx server (as well as servers from other vendors) and vice versa.

That said, WCF is newer, richer, better supported, and supports more WS standards than does asmx. You will certainly not be locked into only supporting WCF services.

alexdej