Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio/SOAP - 'Add Service Reference' vs 'Add Web Service Reference'

I've found that I can import a SOAP/WSDL service that I plan on using into my solution either as a "Web Service Reference" (System.Web.Services) or as a "Service Reference" (System.ServiceModel / WCF).

I was wondering if what the differences were. I understand that 'Add Service Reference'/WCF is newer, are there any disadvantages to using it over System.Web.Services or is it now the preferred way of consuming SOAP services in .Net?

like image 503
chillitom Avatar asked Feb 03 '10 14:02

chillitom


1 Answers

The preferred and most useful way is indeed to use Add Service Reference. This will add your service as WCF client side proxy.

Add Web Reference is the "old-style" ASMX/ASP.NET webservice way of doing things.

WCF is the much better choice than ASMX, because:

  • it's newer and will be supported in the future (ASMX is on the way out); if you learn it now, you won't have to learn it later when ASMX is definitely gone
  • it offers much more flexibility in every aspect
  • you can only ever host an ASMX service is IIS, using HTTP as your protocol; WCF can be hosted in IIS; self-hosted in a Windows NT Service; WCF can use HTTP, NetTCP, MSMQ and many more protocols
  • WCF offers a lot more security and other settings, making it much more powerful to use

Yes, WCF has a bad rap about being really hard to learn - I don't really find that to be true. Check out those beginner's resources - very useful indeed!

  • MSDN WCF Developer Center which has everything from beginner's tutorials to articles and sample code
  • Endpoint.TV screen cast series by Aaron Skonnard on WCF (at Channel9) - it's an excellent series going from "Creating your first WCF service" and "Creating your first WCF client" all the way to rather advanced topics. Aaron Skonnard very nicely explains everything in 10-15 minutes screencasts - highly recommended!
  • DotNet Rocks TV Show #122: Miguel Castro on Extreme WCF
  • DotNet Rocks TV Show #135: Keith Elder Demystifies WCF
like image 174
marc_s Avatar answered Sep 22 '22 09:09

marc_s