Understand WCF: Part-1: What is SOA, Services and Messages

Welcome to the Understand WCF article series. This is the first presentation of this article series. The purpose of this article is to understand WCF from the very basics. If you are a novice programmer then this series is exactly for you. If you already have hands-on experience with WCF but have not worked with it for a while then this article will help you to brush up on your skills.
 
So, let's start with stron enthusiasm. Oh, let me tell you the reason for this article series. Currently we have begun work with a few services in the Medical domain. (Such as HL7, HIE and so on. I know that HL7 and HIE are far more than a simple service; they are beyond the scope of this article) and to implement them we need to create a service application. These services can be consumed by any client. So, it's time to brush up on my WCF skills. When brushing up, why not write them? OK, are you thinking that WCF is too old where the WebAPI is in the market? Guy's technology to be applied in an application is not in my hand. So let's not discuss why WCF and why not WebAPI.
 
Let's return to our main explanation. As I said, this series is intended for beginners, those who want to host their first WCF application. At first we will clear up a few basic understandings and vocabulary and in a future article we will cover each concept with examples.
 

What a SOA is

 
You may think that the article is all about WCF but we will explain the SOA. I think that to understand any technology, we first need to understand the backbone of it and the reason behind the technology.
 
The acronym SOA stands for Service Oriented Architecture. Now the question is, why is the Service Oriented Architecture needed? What is the problem in normal Object Oriented Programming languages?
 
In the 80th century procedure oriented methods and function oriented methods became very popular. Everything was represented by functions. And people were happy by calling those functions by name and parameter.
 
In the 90th century people felt that they needed to represent real-world objects in terms of programming. They created the concept of objects, classes and many more. The problem begins after that. Then two or more programming languages became very popular in the market (let's think C# and Java). Both have good features, they produce native code that is very nice for creating platform independent applications. Both run in their own runtime environment and many more. But the problem started when one application wanted to talk with another application. For example, my C# application wants to call one class of our Java application. How do they communicate? The solution is SOA. People understood that if there is one common language between them then they can talk to each other. What is the common language? The answer is XML.
 
And the style to communicate between two applications by passing messages is nothing but SOA or Service Oriented Architecture.
 
So, in conclusion, SOA is nothing but an architectural style where two non-compatible applications can communicate using a common language and WCF is nothing but one example of the Service Oriented Architecture (SOA).
 

What a Message is

 
You know better than me. During an entire day we send and receive hundreds of messages in our mobile. Ha Ha..Yes, a message in WCF is very similar to messages in the real world. In the previous paragraph we explained how two applications will talk? People decided to communicate with messages. Now, the question is what will be the language of the message. The language can be anything, except the requirement is for both to understand the language. Hm..There are few languages that only two people can understand. Young guys hope you got it. Ha.. Ha.. So, we were explaining message formats. The format can be XML, JSON or even a plain CSV file. Here is a simple diagram to understand the concept of messages.
 
WCF 
 
Now, there is no need to call a Java class from a C# class. When they want to talk with each other they just send a message to each other. In the Next programming industry though it's fine and cool to communicate via messages but there should be some standardization of those messages. Then, when people try to exchange data between two programs they send the standardized message to get it done. In future articles we will focus more on message standards.
 

What a Service is

 
Again we are familiar with the term service. "It's a logical encapsulation of self-contained business functionality". What does that mean? It means that the service is (each and every service) logically encapsulated within some other container (WCF server) and those services are self-contained.
 
Let's now think about a Petrol filling service in a filling station. There might be various service like:
  • A Car can fill up with either Petrol or Diesel.
  • There is a facility for checking air pressure.
  • A small puncher shop is there within the filling station.
The filling station is providing three services that are logically encapsulated within one filling station and they are self contained. In other words, if one service becomes damaged then we can replace it by a new one without effecting another.
Before ending the first presentation we would like to clarify one concept regarding services. If you think that services are nothing but a class or object then you are wrong in theory.
 
Services are not classes or namespaces or objects. It's just self-contained business functionality.
 
Conclusion
 
This is our first step toward learning about WCF applications. Here we have explained three fundamental ideas of communication, they are SOA, messages and services. Hope you have understood the concept. In future articles we will dig more into WCF services.
 


Similar Articles