Wcf Architecture In Depth Information Technology Essay
Nowadays distributed system becomes increasingly significant and a great number of developers utilize that technology to build their applications. One of the most common used technologies is WCF which stands for windows communication foundation. WCF is utilized on windows platform and .NET framework. On .NET framework WCF is the first service-oriented model. There are three important components in WCF in terms of programming model and they are address, binding and contract. Moreover, there are two layers in layer structure of WCF and they are Messaging layer and Service Model layer. In order to understand WCF deeply some good features of WCF will be introduced such as unification of different technologies, interoperability with other existing applications and fully support for Service-Oriented development.
Key words: WCF, service-oriented development, architecture, layers WCF, unification and interoperability.
WCF, which stands for Windows Communication Foundation, is utilized by many distributed system application developers for its outstanding advantages. WCF enables developers to build their applications which can meet different requirements by unifying current distributed technologies. Applications developed by utilizing WCF can interact with other applications developed in other languages and on other platforms easily. Updating conveniently is another advantage WCF has, since it is unnecessary to re-deploy the whole application if only a part of the solution needs to be modified. Address, binding and contract are the three essential components of WCF. Address is used to guide the packets to the destination. Binding’s responsibility is to specify the methods how the packets are sent. Contract is in charge of what message the packets should have. The layer structure of WCF will be introduced in this research as well. Messaging layer and service model layer are the two layers. WCF has some outstanding features and these features will be illustrated in the following paper.
WCF utilizes service-oriented as its model, as a consequence, it is necessary to introduce the service-oriented architecture (SOA) before introducing WCF. Comparing to object-oriented architecture, SOA can solve many problems which are brought up by object-oriented architecture. For example, different components of an application do not depend on each other tightly, so modifying applications so as to meet the business needs is not expensive and complicated any more. Some of the significant features and principles will be illustrated as follows.
The definition of SOA is that SOA contains a set of services and these services were designed well by other developers. Hence, different services have a loosely-coupled relationship which enables developer to modify any services as needed without affecting any other services. More specifically, in object-oriented model changing only a small part of the solution will lead the whole application to be redeployed. However, in SOA all the services do not depend on each other tightly and they are all autonomous. The client side of an application has no clue about the implementation process on the sever side and vice versa, as a consequence, implementing and modifying services on both client and server is flexible. If a service needs to be updated and the service is still available there is no need to modify services on the client side. Schemas and contracts, which are two significant component of SOA, are two aspects that SOA concentrates on to communicate with different nodes rather than classes. As a consequence, SOA enables the distributed application platform and language independent.
ARCHITECTURE OF WCF
WCF has attracted more and more attentions due to many pros of it. Before WCF was invented, what developers utilized to develop applications were DCOM, .NET Remoting or Web service. However, these technologies brought many drawbacks including security, cross-platform and performance and so on. After WCF was invented a great number of developers had started to utilize the new technology and the problems mentioned above can be solved by WCF completely. In order to understand deeply about WCF, the architecture of WCF will be illustrated as follows.
Communication through the endpoint
Â·The most important components of WCF are address, binding and contract. Address is responsible to inform the data packet where to go. Binding is in charge of the way how to communicate with the services. Contract is used to define what the service contains or what the service is able to do. These three components of WCF are also known as ABCs of WCF. Endpoint as shown in the figure 1 constitutes address, binding and contract and it is can be seen as the gateway for other clients. In order to communicate with a service, clients should know the ABCs of that service. As we know, the Web Service Description Language (WSDL) is responsible to describe what an endpoint can do and how to access that endpoint.
Figure 2 
WCF Programming Model
Figure 2 shows all the components of WCF programming model more details about this Model will be illustrated as follows. There are two sides of this programming model and they are client side and service side.
The client side can only consist of one endpoint which has address, binding and contract for each service. In the whole program the client side contains a proxy which enables the client to communicate with the service. When communicating with different services the client can utilize multiple proxies which use multiple endpoints accordingly. A proxy is utilized to fulfill the job of CLR interface which has the same the function as service contract. Proxy not only does the job of service contract but also provide extra functions to manage the life cycle of a proxy. All the attributes of a service are assembled by a proxy such as service address, service running environment and transport protocols. Different behaviors can be defined by the client in order to configure the local configuration files including instancing, concurrency, transaction control and security.
There can be multiple endpoints on the service side and these endpoints are in charge of sending messages to a service if there are some services requesting message sending in. behaviors do the same jobs as the behaviors do on the client side.
On the service side there is a significant component named dispatcher which is related to the proxy in the client side. Proxy and dispatcher work together to convert between methods that clients desire to invoke and WCF messages. Channel dispatcher and endpoint dispatcher constitute one channel stack. Channel dispatcher is responsible for getting messages from the channel and choosing the endpoint dispatcher in which these messages will be dealt with. Endpoint dispatcher consists of filters and dispatch runtime. More specifically, it is the filters that make sure the incoming messages are dispatched to the right function within a service object. After the messages are dispatched to the endpoint dispatcher, the message will be transfer to dispatch-runtime within that endpoint dispatcher. The object of Dispatch-runtime is utilized to choose which function to call and serialize or de-serialize functions’ parameters and control objects’ lifetime.
More details about ABCs of WCF
Address is utilized to tell clients where the location of the service is. Of course, before a client can communicate with the service side, it needs to know the address of the service first. The format of the address in WCF is URLs. In the URLs, many things are defined including protocols, the address of the terminal providing services and the path which can enable the client to get access to the actual service. In URLs port number in address is not fixed and which port number to use depends on the types of transmitting protocols.
More specifically, there are four parts of the address section. Firstly, transport scheme is responsible to define the protocol which is used to transfer message. Secondly, Name of the service machine is used to locate the machine which provides the services. Moreover, the name for that machine should be fully qualified domain name which can be translated to the right IP address by some DNS servers. Thirdly, what port number developers can use totally based on transmitting protocol. By default port 80 is for HTTP address. The last one is path which is the name of the directories. Here is the format of address Scheme ://< hostname of service > [: port number]/path1/path2.
Binding plays a vital role of defining the method to communicate with service side. Binding is responsible to control transport, channels, encoding and WS protocols. WCF has provided a large number of models of binding and these models can almost satisfy most of the developers. Custom binding can be built to meet the needs of developers who have special demands for the binding model.
More specifically, a binding can be seen as a multiple layered stack which contains one or multiple channels and these channels are in charge of processing data. Transport channel is at the lowest level of this stack which is utilized to adapt the stack to the transporting protocols such as TCP, HTTP and SMTP. This special stack is used to supply with a concept. And that concept is responsible to define in which way the message should be sent and to define what the messages should contain or what protocols should to be used for transmission.
Contract is used to define what a message should contain or what services the service side can provide. More specifically, it is the contract that defines what services need to be exposed to outside thereby deciding what to implement inside. Moreover, contract enables the interoperation between different platforms to be authentic. Three different types of contract will be illustrated as follows. The first one is service contract which is utilized to define the transmitting methods among clients and services. Message contract is the second one and is used to define the message architecture. SOAP envelop can be modified by message contract. The last one is data contract which holds the information of classes such as types defined in classes and that information will be transferred between clients and service.
There are three messaging transmission methods and they are one-way, request-replay and duplex. In the one-way pattern a client sends out messages to the service, but the client does not wait for the response of that service. The pattern is like invoking an asynchronous function which does not have a return value. The second pattern is request-reply pattern in which the client will wait for a response from service after sending a message. That client is able to do nothing until it receives the response from the service. In other words, the request-reply is a two way interoperation which can be seen as a synchronous communication. This request-reply pattern is utilized as the default method in WCF. The last one is duplex pattern and this pattern is the most complicated manner comparing to other two patterns. The duplex pattern is a real peer-to-peer communication and the client and the service send and receive messages simultaneously which are transferred on different channels. In this method the client and the service can be seen as the message initiator.
THE LAYER STRUCTUR OF WCF
The layer structure of WCF
WCF has a layered structure which contains two different layers and they are service model layer and messaging layer. What a developer to do on the service model layer is to do the programming task, however, the messaging layer, which is underneath the service model layer, is responsible to transport the all the messages to the destination. The concept of layer structure enables to separate the programming from the messaging. As shown in the figure 3, service model layer is the top layer which is in charge of contract, policy and behavior. And behavior is the most significant part among these three. Channels, encoders, transports and protocols are the components of messaging model in which the channels is the most important part.
In messaging layer all the real messages are transferred on this layer which is similar to the network layer and data-link layer in OSI model. Moreover, transports protocols are defined at this layer as well. Format for the messages and the message’s encoding rules are both defined at messaging layer too. Channel is a function that the messaging layer provides which is responsible to transmit messages among clients and services. Channel function is so important that messaging layer is sometime called channel layer. Address and binding are two significant components in channel. Address is utilized to tell the message where the service location is and the binding’s responsibility is to manage the methods that messages should be sent. In order to enable the messaging transmission to work well between clients and services, both the client and service need to understand all the variables such as protocols, the encoding, method defined to transfer message and transport. It is the factory that enables the client side to create channels so as to communicate with services. Listener plays the role of accepting messages from client side through predefined channels. Channels’ another function is that it can monitor the forwarding messages and receiving messages by utilizing specified transport and messaging transfer method.
Service Model layer
Service model layer enables to affect the messaging process by utilizing object-oriented programming rules. When developers design their applications the design actually happens at this layer. In other words the service model layer responsible for the design of the application and it provides user-friendly API which includes classes, functions, attributes and configurations. In service model layer the most significant part is behavior and client and service can have multiple behaviors. Behaviors do have effect on the translation from messages to .NET attributes rather than affecting on contract.
UNDERSTAND WCF IN DEPTH
Unification of current technologies
Nowadays a number of distributed technologies are utilized by developers to develop their applications. Although there are some advantages of these technologies, these technologies brought many problems. These technologies utilize different programming languages and models. If developers desire to build distributed system they need to utilize distinct APIs. WCF is the new technology which enables developers to build distributed system for different business corporations by utilizing only one API. WCF can be seen as the combination of these current distributed technologies such ASMX, .Net Remoting, MSMQ and WS-* technology. WCF also inherits the advantages of these technologies such as efficiency from ASMX, extensibility and flexibility from .Net Remoting and so on. Some of the technologies will be illustrated as follows.
ASMX stands for ASP.NET Web Services which provides great interoperability and the ability to make packets pass through firewall easily. ASMX transfers data through messages as well. Different transport protocols can be utilized to transfer message such as HTTP and TCP. And the main protocol for message is SOAP the format is XML. However, ASMX is not flexible in choosing delivery methods and security manners. It is the ASMX that enables to communicate to applications which is developed by J2EE across the internet. ASMX has been seen as a very outstanding vendor-independent technology.
.NET Remoting has a good support for the lifetime management and self-defined hosts. Moreover, it has an outstanding extensibility and flexibility. If there are many boundary clients which needs to communicate with a central server .NET Remoting is the best choice, because the both the client and the server should be developed on .NET environment. This .NET to .NET architecture provides the best performance.
Enterprise Services is the next generation of COM+ and can be utilized to manage the lifetime of object and specify the distributed transactions. Enterprise services enable developers to focus on building service-oriented components. The interoperability is one of the relatively serious drawbacks. And the number of communication protocols which support this technology is small.
WSE stands for Web Services Enhancements and can be utilized to talk to J2EE based applications. A large number of the agreements which are defined in web services have been implemented in WSE, as a consequence, WSE can be called WS-* specifications. WSE can ensure the security of an application.
MSMQ is the abbreviation of Microsoft Message Queuing. MSMQ enables to send messages to the partner applications which are not available or online. In other words, MSMQ lets the messages stayed in the queue and sends the messages to the server when it is available. MSMQ is the best for applications that the servers are not online all the time.
Unification feature of WCF
Figure 4 shows the summary information about the technologies that WCF has unified. As we can see from figure 4, WCF provides more for developers, which enables to build applications much conveniently and efficiently.
How to unify different technologies
WCF enables developers to use all the good points from other technologies straight away. In order to make the other technologies work for WCF, developers need to attach specified elements to the contract of WCF. WCF can gain a great number of good features due to the unification of others technologies. Some of the good features which inherited from Web Service are shown as follows.
Because WCF has a good support for web service, WCF gains some good features about security. WS-security and WS-Trust enable WCF to provide many functions including integrity checking, authentication and so on. These features can ensure the security for the transmission for SOAP messages. WS-Reliable messaging adds an additional tag into SOAP header which enables WCF to ensure its communication much reliable. WCF also supports the integrity of the data because of the feature of WS-Coordination and WS-Atomic. WS-Addressing can be used to make the messages transmission without utilizing transport protocols.
Interoperability with Other Platforms
Nowadays distributed applications are developed in many different languages and the technologies utilized are invented by many different vendors as well. That situation happens in many enterprises and the applications using WCF can communicate with other applications using other language or software because WCF utilizes SOAP as its communication protocol. WCF based applications are able to interact with applications working in distinct process on same terminal and applications working on other terminals. Applications built on WCF can interoperate with each other when they are run on different operating systems such as Linux and windows. WCF is able to enables the previous technologies to with compatibly with itself. More specifically, SOAP is utilized by both ASMX and WCF; as a consequence, ASMX built-on applications can work compatibly with applications which are based on WCF.
Service-Oriented Development is supported
Over the next few years, creating applications in a service-oriented style will become the norm. For this to happen, the platforms on which those applications are built must provide the right support for creating service-oriented software. Achieving this is one of WCF’s most important goals.
Building distributed applications by using Services-oriented Development will be increasingly popular. WCF is seen as the first service-oriented development technology in the platform of windows, which provides a good support for platform independent and updating services conveniently.
What does WCF concentrate on is the service rather than object. Some of the key principles about WCF are illustrated as follows.
The first one is shared schema. Communication between applications never depends on classes anymore and what they depends on is schema which has be predefined in both of these applications. The behavior transferring attributes such as classes or functions will be banned. Secondly, services are all independent. An interface should be defined between clients and services, which enables the application language and platform independent. However, the clients and services should be loosely-dependent. Lastly, the boundaries should be defined clearly. The explicit boundary enables the remote objects to be seen as they are local.
In conclusion, WCF is a Windows platform service-oriented technology which is able to provide interoperability between different applications. Nowadays distributed application developers prefer to utilize technologies built on service-oriented architecture. One of the advantages of service-oriented architecture is that different components of an application depend on each other loosely, so modifying application in order to meet the business needs is economical and easy. WCF is an outstanding representative of SOA and it has three significant components in its programming model. The three components are address, binding and contract. Address is used to tell where the message should be transferred. Binding is responsible to define how to communicate to a service. Contract is in charge of describing what services are provided. There are two layers and they are service model layer and messaging layer in terms of WCF layer architecture. One of the important responsibility in messaging layer is how the real messages can be sent out with all the attributed being serialized. Service model layer is responsible for the design of the application and it provides user-friendly APIs for the future utilization. In order to get a deep understanding WCF, a number of features of WCF was introduced. WCF is like a combination of other distributed technologies and it makes the combination of technologies is much user-friendly.
Shared schema, Independent Services and Clearly Defined Boundaries are the three key principles to SOA.Order Now