views:

740

answers:

3

Hello everyone,

I've been using Webservices so long.

But,so far up to what I know,I haven't found a solid point for using WCF over Webservices.

Webservices hosted with Cassini webserver = WCF?? Is that all?

Thanks

+3  A: 

A couple of pretty big advantages would be multiple end point binding, greater support for WS-* standards, it can be self hosting and has transaction management for a start.

lomaxx
+3  A: 

WCF is an much larger communication framework that offers support for web services, message queues, TCP-based connections, named-pipes, RESTful services, etc. It allows you to host a service in different ways (IIS, console app, windows service, winforms app, etc.) with any number of different types of endpoints.

To answer your question, if your web-service is an .asmx service, then you are not using WCF. If you service uses classes from the System.ServiceModel namespace, or your config file includes a <system.serviceModel> section, then you are using WCF. I'm not sure if Cassini supports WCF.

Andy White
+4  A: 

WCF is a communication stack that allows services to be exposed over HTTP (like ASMX) and TCP (like Remoting) as well as Named Pipes, MSMQ and with .NET 3.5 REST.

It allows this because it allows for decoupling the communcation parts of the service away from the business logic parts. All you need to do is decorate your service classes, methods and DTO's with the appropriate contract attribute ([SeriviceContract], [OperationContract] and [DataContract] respectivly.)

This had the benefit of being able to write a service once, and allowing many different kinds of clients to consume the same service (i.e. Java clients can use HTTP, .NET clients can use TCP, legacy can use MSMQ, etc.) using multiple bindings and endpoints.

WCF will still allow you do use all the features of each transport, including security, transactions, reliable messaging, etc., but you need to use some care. Not all features work on all transports, and you need to design accordingly. WCF allows you to specify in your contract which features are required. This prevents somone from trying to expose your service in a way that does not support the required feature set (i.e. if your service requires transactions, the WCF runtime will not allow the service to be accessed via a basic HTTP endpoint).

WCF is also highly extensible via custom behaviors (which influence how the WCF runtime works) and custom channels (which control how WCF services communicate with the outside world.)

WCF has a bit of a learning curve compared to ASMX, but the benefits ABSOLUTLY out weight this learning curve.

Jonathan Parker