WCF or XML Web Service?

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:

  1. if you move your service to WCF, will my application be able to communicate with the service as before?
  2. 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...

Technorati Tag: ,

Print | posted on Wednesday, September 17, 2008 10:24 AM

Comments on this post

# re: WCF or XML Web Service?

Requesting Gravatar...
very good article for a starter, solved many problems of mine. Thanks
Left by prashant kumar on Oct 07, 2008 3:20 PM

# re: WCF or XML Web Service?

Requesting Gravatar...
You state above that "a WCF service can be configured to be like a simple XML Web service from a point of view of a any client application".

I currently have some clients who have hardware that submit data as an XML web service client, but have recently upgraded the web services to WCF.

As it would be difficult to get all the harware clients upgraded, could you possibily shed some light - or point me in the right direction about how to modidy the WCF service to accept incoming messages?

Thanks for any help - much appreciated!
Left by Jon P on Oct 15, 2008 7:37 PM

# re: WCF or XML Web Service?

Requesting Gravatar...
Hi Jonathan,
I've not understood too much what you mean but I try to help you...
You can expose a WCF service exactly like an XML Web Service, so it's so strange that you've problems.
If you've problems, you can check posts like this:
blogs.msdn.com/.../...ng-a-wcf-service-in-iis.aspx
Maybe if I've time I'll write a step by step guide...
Left by Stefano Demiliani on Oct 16, 2008 3:46 PM

# re: WCF or XML Web Service?

Requesting Gravatar...
Nice article
Left by Avinash Pohane on Mar 09, 2009 10:35 AM

# re: WCF or XML Web Service?

Requesting Gravatar...
Great post, this helped me out alot.
Left by Rakeback on Jan 28, 2010 11:07 PM

# re: WCF or XML Web Service?

Requesting Gravatar...
1. you move your service to WCF, will my application be able to communicate with the service as before?
2. 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...
Left by wholesale laptop adapter on May 23, 2010 2:29 PM

# re: WCF or XML Web Service?

Requesting Gravatar...
great boss. really great
Left by Nijeesh on Jul 01, 2010 7:26 PM

# re: WCF or XML Web Service?

Requesting Gravatar...
Nice artical.very helful...G8 job..
Left by Neha on Nov 09, 2011 9:04 PM

Your comment:

 (will show your gravatar)
 
Please add 4 and 4 and type the answer here: