开发者

ServiceContractGenerator vs ServiceDescriptionImporter

开发者 https://www.devze.com 2022-12-11 15:38 出处:网络
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. Curre开发者_Go百科ntly, it uses ServiceDescripti

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. Curre开发者_Go百科ntly, 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消