What is SOA, Services and Messages


Welcome to the WCF learn series. This is the first presentation of this chapter series. The purpose of this chapter 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 chapter will help you to brush up on your skills.
So, let's start with strong enthusiasm. 

What a SOA is?

You may think that the chapter 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 on 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 a 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.
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 programming industry though it's fine and cool to communicate via messages 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 chapters, 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 with a new one without affecting 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.


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 chapters, we will dig more into WCF services.
Next » Understand RESTful Service