In the past we've made lots of services that permits the interoperability between different applications and different clients, and all of them was based on .NET XML Web Services.
Now that Windows Communication Foundation is out, I'm involved on a migration of some of these services to this new platform and I'm observing that there's not always a clear idea on what WCF is and what this platform can do.
The classic questions I receive are mainly two:
- if you move your service to WCF, will my application be able to communicate with the service as before?
- Actually I have a Java application that works with your service. If you move to WCF, should I migrate my application to .NET?
Here I want to solve all these doubts...
First, directly from Wikipedia:
WCF is designed in accordance with Service oriented architecture principles to support Distributed computing where services are consumed by consumers. Clients can consume multiple services and services can be consumed by multiple clients. Services typically have a WSDL interface which any WCF client can use to consume the service, irrespective of which platform the service is hosted on. WCF implements many advanced web services (WS) standards such as WS-Addressing, WS-ReliableMessaging and WS-Security.
The WCF unifies the various communications programming models supported in .NET 2.0, into a single model. Released in November 2005, .NET 2.0 provided separate APIs for SOAP-based communications for maximum interoperability (Web Services), binary-optimized communications between applications running on Windows machines (.NET Remoting), transactional communications (Distributed Transactions), and asynchronous communications (Message Queues). WCF unifies the capabilities from these mechanisms into a single, common, general Service-oriented programming model for communications.
WCF can use SOAP messages between two processes, thereby making WCF-based applications interoperable with any other process that communicates via SOAP messages.
As I think now you know after reading the lesson above (
), WCF is completely backwards compatible with the SOAP specification and a WCF service can be configured to be like a simple XML Web service from a point of view of a any client application.
Plus, a WCF service has lots of advantages over XML Web Services, for example:
- Support for multiple transports and serialization formats (XML Web Services are based on HTTP while a WCF service can run on different transport protocols such as TCP, MSMQ, UDP, etc.)
- An XML Web Service supports only the HTTP Request-Reply model, while WCF supports simple, Request-Reply and Duplex channels.
- WCF is an extensible platform.
So, should your WCF client be based on Microsoft technologies?
No... a WCF client can be based on the platform you want. You only need a client able to be compatible with the SOAP specifications.
And in what situations should you choose WCF instead of XML Web Services?
My first answer could be: now that .NET 3.5 is out and now that you've learned that a WCF service could be exactly like an XML Web Service, all the new services should be implemented by using WCF.
However, for giving a more professional answer...
if you have a scenario where you plan that different client applications need to consume your service with different protocols, WCF is recommended. You can write your WCF service and expose different endpoint protocols for every types of different applications that could consume the service. You can obtain a complete and flexible SOA solution...