After years of thinking about SOA, it finally started to ferment. The emergence of WCF in the Microsoft World simplifies the foundation of implementation. SOA emphasizes the following priorities:
• All technologies follow open standards
L The boundary of the service definition is clear
L service autonomy and not subject to other services
L only share contracts and principles between services
These concepts are abstract, practical design and writing are cumbersome and difficult to maintain, and WCF tries to separate the business logic we need to develop with the basic requirements of SOA. System developers are still focused on the needs of the users, to meet the characteristics of SOA, only need to follow the WCF specifications to provide the definition, the platform to be responsible.
In other words, to implement the SOA concept, it is easy to develop a custom service integration environment and execution platform. In emphasizing assembly, reuse and integration, procedures follow standards, sharing data contracts and service contracts, rather than tying them to basic data patterns and categories. In an open architecture, communication across heterogeneous platforms becomes basic, flexible, safe and efficient. When these problems become basic needs, the roots are strong to flourish. Microsoft has launched WCF to clean up the bottom barrier for architecture engineers and program designers.
What is WCF
WCF full name is the Windows communication Foundation, the program code name is "Indigo", is built on. NET Application Communication Framework, set Microsoft's distributed Application experience. Integrates the. NET Platform and distributed computing-related technologies such as. NET Remoting, Web service/wse/ws-*, distributed transactions (. NET Enterprise) and message processing (MSMQ), as well as previous com+/dcom technologies. Provides developers with Cross-platform, secure, trustworthy, transaction-managed solutions that are compatible with existing systems.
WCF is built within the. Net Framework 3.0. Windows Vista and the Windows 2008 operating system will contain the schema. Windows XP and Windows 2003 operating systems can also install the. NET Framework 3,0 Runtime separately. The current Visual Studio 2005 does not include WCF, but can download the Visual Studio extensions for. NET Framework 3.0 from Microsoft's Web site to facilitate the development of systems on WCF.
The WCF overall architecture is shown in Figure 1:
Overall architecture of Figure 1:WCF
WCF specification before you write business logic, you need to make the contracts needed to communicate between programs, such as data contracts, service contracts, information contracts, and so on. Then, by setting behavior you can adjust the WCF runtime how to match your service execution, such as whether to provide a WSDL description to the front end, whether to return the complete error message ... Wait
For communication between programs or systems, WCF can cross program (process), machine, LAN, and Internet. A WCF based service whose host program can be IIS, asp.net,exe,windows service,com+ ... Wait The network protocols supported by WCF include SOAP, HTTP, Named Pipe, TCP ... , and its security mechanisms include a variety of encryption and decryption algorithms, SAML, Kerberos, X509, account/password and other standards and patterns, you can also customize the protocol and security mechanisms to extend its functionality.
In addition, the Channel in the messaging block in Figure 1 represents the stack of various functions when transmitting. Although it is painted together, but there is a logical hierarchy of points, such as Transaction flow the highest, reliable second, security again, and HTTP, TCP, Named Pipe belong to the underlying transport protocol.
All in all, WCF includes all the techniques associated with program communication, and has done a bunch of ws-* standard specifications for you defined by the OASIS Organization . Familiarity with WCF is the first step in simplifying SOA development.
WCF The advantages
In a nutshell, WCF has the following benefits:
• Unified: As mentioned earlier, WCF integrates Microsoft's historically distributed development technology.
L Compatibility: fully compatible with old systems. Installing WCF does not affect the existing technology within the enterprise and can still communicate with it.
L Integration:WCF supports a variety of communication protocols to ensure interoperability between systems, and expects to be integrated across heterogeneous platforms through standard Ws-*/web SERVICE/SOAP specifications.
L Security: supports a wide range of security mechanisms, such as ws-security,ws-trust and ws-secureconversation, that are regulated by ws-* for a variety of security issues such as user authentication, data integrity verification, data privacy, and more.
• Reliable message communication: The general requirements for reliable communication can be divided into two parts, one is security, the other is the quality of sending and receiving messages at both ends. Part of the security as described above, WCF supports ws-reliablemessaging, ws-addressing standards, and provides trustworthy end-to-end communication . It also supports MTOM specification (message transmission optimization mechanism, messages transmission optimization mechanism), so that large binary data can be effectively transmitted.
• consolidation queues : The above message quality refers to both ends of the application at the same time on the online end-to-end communication. WCF also supports passing messages through queues (queue) so that both ends do not have to exist in the same time space.
• Transaction management: based on the ws-coordination and ws-atomictransaction standards to integrate heterogeneous platform transactions, provide a two-phase transaction agreement required by a distributed exchange (two-phase commit Transactions).
• Simplify development: Let the previously freehand feature change to set up (according to Microsoft's example, the original need to write 56296 lines of code into 3 lines of program code, 4 lines set).
The benefits of a table listing so many WCF are of course not enough J, the architecture above Figure 1 is not words to do. Here's a good book about WCF "microsoft Windows communication Foundation Step by step", the author is John Sharp,microsoft Press. It has the characteristics of the step through step series, which is guided by a number of practical examples. But the difference is that the technology cited in this book is broad and deep .
This book has 16 chapters, using the first three chapters to introduce the basic principles of WCF, the rest for different requirements, in-depth interpretation and complementary to the implementation. The first chapter starts with a simple paradigm, using a client-side application called Service on WCF. The second chapter introduces the System.ServiceModel.ServiceHost category of the. NET Framework 3.0 to host the services we compose, but because it is only a category, it is not executed. The author further demonstrates how to compose a WPF and a Windows service two application types to load a previously authored service.
When system integration, there are many uncertainties, because each system development team on the requirements and specifications of the different knowledge, technical ability is mixed, naturally there will be many exceptions error. However, these errors need to be passed between heterogeneous platforms, so WCF needs to be able to present the Exception of the. NET Framework to SOAP Fault, which is the subject of the third chapter. It also demonstrates how to pass back the custom error structure after defining the DataContract.
The fourth chapter discusses how to protect the users ' security when they communicate with the server through the network. In this chapter, you can understand that only through the setting, through WCF has provided complete functions can easily complete the verification, signature, encryption and decryption mechanisms. The fifth chapter extends the discussion of security to the Internet.
The sixth chapter mainly introduces the service and data Contract version control, as well as the proposed update version of the practice. The seventh chapter describes how to maintain client state on the server side, but it is closely related to the life cycle of the service instance. The eighth chapter discusses the distributed transaction, and explains how to deal with the front-end program-controlled transactions through simple sample code, but unfortunately it does not have much to do with heterogeneous platforms. The Nineth chapter describes how to maintain the quality of communications, and by guaranteeing the message order of the unique identification/numbering and failure mechanisms, can prevent hackers replay attacks (replay attack).
The tenth chapter discusses how to set and manage the functions provided by WCF by program, and also explains the two blocks of Service Runtime and messaging in Figure 1. The 11th chapter discusses one-way (OneWay) and asynchronous communication methods, this and whether the user side needs server-side response, and whether there is a need for synchronous processing of a single demand, the design will affect the overall system efficiency and front-end program smooth or not. The 12th chapter explores the MTOM specifications for the flow limits provided to ensure efficient use of resources, as well as the transfer of large binary data such as multimedia data. The 13th chapter introduces the message's balance, and demonstrates that the load balancing (load balance) is achieved by the requirement of the user side. The 14th chapter describes the reverse call to the consumer side from the server side, which requires a callback contract (Callback contract) to be defined on the server side and implemented by the user side. When a client-side event occurs on the server side, it can call the client's program in turn.
The 15th chapter introduces the Windows CardSpace technology introduced in the. NET Framework 3.0 To verify the identity of the user. Through the implementation, let the author from ignorant to understand its architecture, and how to integrate vouchers (certificate) to ensure the security of both sides. The last chapter of this book explains how to use the Web service< that was previously developed with ASP.net