This article will not talk about how to create and host a WCF service rather we stress on importance of SOA and WCF.
If you are a advanced WCF developer then article is not for you, if you are one who is trying to learn WCF then article is not for you, this is for them who is completely new to WCF and trying to understand why WCF is there.
Evolution is the nature’s law. Just like Human beings who evolved from Primate to Modern age Humans just to adapt the moving environment and competitions, Programing style or we can say technique also evolved to overcome the challenges in the changing programming world.
Procedural Programming
Initially programmers used this approach for developing applications where Functions were everything.
In this approach Functionalities will be encapsulated inside one or more functions, which can call each other, pass some parameters and get some return value. Here one of the functions will be made as entry point (like in C programming we had main method).
Why it need to be evolved.
The biggest challenges with this approach were,
- How to reuse the same code?
- Difficulties in code Management.
Object oriented Programming
To overcome the problems in the Procedural programming, object oriented era comes into the picture where people start talking in terms of objects and classes.
Everything is treated and considered as real world objects created from the blue print that is class.
Lots of Object oriented principles like Abstraction, Encapsulation, Inheritance, polymorphism and solid has been introduced are introduced in this era.
Why it need to be evolved.
OOP increased the reusability and thus improved the code management. But one thing which was not addressed here was how two or more applications will communicate each other,
especially when they have been written using different languages or technologies.
For instance inventory module which is written using Java will not be able to call function inside classes of accounting module written in .NET.
Service oriented Programming
We have progressed from functions, to objects and now to services.
In SOA functions and tasks are created as loosely connected independent services communicating via messages.
Service provider publishes the service via standard interfaces in a publicly accessible directory called
Service Repository and Service consumer make a service request and in response gets the Service Response.
Architecture Terminologies
Before we go in depth and talk about SOA (Service oriented architecture), it’s must to understand some terminologies related to architecture.
Patterns
In simple words Pattern is a solution to a problem in a context.
Architectural Style
When we say architectural style, it’s a very high level thing, it’s a concept. It’s up to us how we take this and implement. For example REST is an architectural style which tells us how we can use standard web features in effective way. It’s not standard or specification, in a style which we can understand and design web services in that style. In my perspective n-Tier is also an architectural style, it says divide your systems into different tiers but middle tier may be anything, and developer can make it a simple class library or a WCF service. In face the value of ‘n’ is also not sure.
Architectural Patterns
Architectural Pattern is something which solves our problem at sub system level or in short module level. It deals with the problem related to architecture of a project. We make Class libraries, Components, Web services to solve the problem. For example - In MVC we break the application into Model, View and Controller. Here we know how View interacts with model and so on.
Design Patterns
Design pattern talk about problems at class or function level.
What is SOA?
SOA or Service oriented architecture is an architecture style for building business applications by means of services. Application comprises collection of services which communicate through messages.
Service
- Services are logical encapsulation of self-contained business functionality
- Every Service encapsulates one action such as Register User, Send Email etc.
Messages
Services communicate with each other using messages. Messages are standard formats which everyone (every service) can read and understand.
Characteristics of SOA
- In SOA, Services should be independent of other services.
Altering a service should not affect calling service.
- Services should be self-contained.
When we talk about a RegisterCusomer service it means, service will do all the necessary work for us, we are not required to care about anything.
- Services should be able to define themselves.
Services should be able to answer a question what is does? It should be able to tell client what all operations it does, what all data types it uses and what kind of responses it will return.
- Services should be published into a location (directory) where anyone can search for it.
- As I said, SOA comprises of collection services which communicate via standard Messages.
Standard messages make them platform independent.
(Here standard doesn’t mean standard across Microsoft it means across all programming languages and technologies.)
- Services should be able to communicate with each other asynchronously.
- Services should support reliable messaging.
Means there should be a guarantee that request will be reached to correct destination and correct response will be obtained. - Services should support secure communication.
WCF and Web services
WCF is a Microsoft framework for building Service-Oriented applications.
Comparing Web services with WCF will not be a good idea. Can you compare yourself with yourself in past(let's say two year before)? Obviously in two year you might have learned new things, improved somewhat,right? WCF and Web service are related to each other in same manner. WCF has evolved from Web services and so WCF can do all which a web services is capable of, plus can do some more.
Features of WCF
What is ABC in WCF
We had gone through the feature of WCF and understood why its termed as advanced version of web services. Now it’s time to answer a very basic question related to WCF i.e., what is ABC of WCF?
When we say WCF, we came across end points. Service endpoint can be a part of continuously hosted service hosted in IIS or service hosted in an application.
ABC or Address, Binding and Contract are the three elements which constitutes and Service Endpoint.
- Address - Where Service is residing (URL of the service.)
- Binding – How to talk to the service?
Example – basicHttpBinding, wsHttpBinding, webHttpBinding etc.
- Contract – What can the service do for me?
Conclusion
We have understood
- What is Service oriented architecture?
- Why SOA required?
- What are the characteristics of SOA?
- How WCF can be differentiated from Web service?
- What are the characteristics of WCF?
- What is mean by ABC of WCF?
In the coming up article we will try to talk about each of the WCF feature in more detail.
Hope all of you enjoyed reading this article. Thank you for the patience.
For technical training related to various topics including ASP.NET, Design Patterns, WCF and MVC contact
SukeshMarla@Gmail.com or at www.sukesh-marla.com
For more stuffs like this click here
Subscribe to article updates