SlideShare a Scribd company logo
In this session, you will learn to:
Identify WCF
Explore the programming model of WCF
Objectives
WCF is a unified programming model for developing
service-oriented applications.
It combines the features of all the distributed technologies,
such as COM+ services, .NET Remoting, and Web
services.
It enables you to build a secure, reliable, and robust
application.
It enables two applications to communicate across platforms
in a distributed environment.
Identifying WCF
To understand the architecture of WCF, you should be
aware of the following fundamentals of WCF:
Unification: WCF enhances the development of distributed
applications and increases developer’s productivity by unifying
the following technologies:
COM+ services
.NET Remoting
Web services
Web Services Enhancements (WSE)
Microsoft Message Queuing
Interoperability: WCF enables two applications built on the
same or different platforms to communicate with each other
within or across a network.
Fundamentals of WCF
Service orientation: WCF provides a highly productive
programming model for building distributed systems that
involve developing loosely-coupled services.
The following figure illustrates the fundamentals of WCF.
Fundamentals of WCF (Contd.)
The following figure illustrates the architecture of WCF.
Architecture of WCF
Architecture of WCF (Contd.)
The WCF architecture contains the following layers:
The contract layer: It contains the various types of contracts,
policies, and bindings used in WCF. The various types of
contracts present in the contract layer are:
The data contract
The message contract
The service contract
Architecture of WCF (Contd.)
The service runtime layer: It specifies how the service will
behave when it runs or executes. This layer contains the
various types of runtime behaviors of the service. These
runtime behaviors are:
Throttling behavior
Error behavior
Metadata behavior
Instance behavior
Message inspection
Transaction behavior
Dispatch behavior
Concurrency behavior
Parameter filtering
Architecture of WCF (Contd.)
The messaging layer: It consists of channels through which a
message is processed and transported to a client accessing
the service. This layer consists of two types of channels:
Transport channels
Protocol channels
The activation and hosting layer: It supports the execution of
services in different environments, such as Windows services,
IIS, and Windows Activation Service (WAS). A WCF service
can be hosted in various ways. These ways are:
Self-hosting
IIS
Windows service
WAS
Exploring the Programming Model of WCF
All communication with a WCF service occurs through the
endpoints of the service.
An endpoint of a WCF service acts as a gateway for
communicating with other applications.
It is composed of an address, a binding, and a contract
known as the ABC of endpoint, as shown in the following
figure.
The address of a WCF service specifies the location where
the service resides.
It is represented in the form of a URL that defines:
The protocol to be used for sending and receiving messages.
The name of the system where the service runs.
The port number at which the service listens to the client
requests.
The path where the service resides and the name of the
service.
The following code snippet shows how you can specify the
address of a WCF service:
address="http://MyComputer:3577/CarDetailsWCFService
/Service.svc"
Address
It describes how a WCF service communicates with a client
application.
It specifies the communication details required to connect to
the endpoint of a WCF service.
It consists of the message encoder and protocol binding
element.
WCF provides the following types of bindings to enable a
client application to communicate with a WCF service:
basicHttpBinding
wsHttpBinding
netTcpBinding
netNamedPipeBinding
netMsmqBinding
netPeerTcpBinding
Binding
It exposes the interfaces, classes, methods, and variables
of a WCF service to enable client applications to access
and use them.
A WCF service may contain the following types of contracts:
Service contract
Operation contract
Data contract
Message contract
Fault contract
Contract
Service Contract:
Acts as an entry point to access a WCF service.
Is implemented as an interface.
Is defined by declaring the [ServiceContract] attribute in a
WCF service, as shown in the following code snippet:
[ServiceContract]
public interface IService
{
}
Contract (Contd.)
Operation Contract:
Exposes the operations that a service can perform.
Defines the methods of a WCF service and the parameters
and return types of the methods.
Is defined by declaring the [OperationContract] attribute
in the WCF service, as shown in the following code snippet:
[ServiceContract]
public interface IService
{
[OperationContract]
DataSet GetDetails(int Employee_ID);
}
Contract (Contd.)
Data Contract:
Is used to expose user-defined data types in a WCF service.
Serializes the user-defined data types in a standard format
(XML).
Is defined by using the [DataContract] attribute in the
WCF service, as shown in the following code snippet:
[DataContract]
public class Employees
{ [DataMember]
public int emp_id;
[DataMember]
public int emp_name;
}
Contract (Contd.)
Message Contract:
Describes the structure of a message exchanged between a
WCF service and a client application.
Enables you to inspect and control the information contained in
a message.
Is defined by using the [MessageContract],
[MessageBodyMember], and [MessageHeader]attributes,
as shown in the following code snippet:
[MessageContract]
public class StoreMessage
{
[MessageHeader]
public DateTime CurrentTime;
[MessageBodyMember]
public Employees emp_id; }
Contract (Contd.)
Fault Contract:
Enables you to send a customized error message to a client by
creating a user-defined class.
Enables you to control the situation when a WCF service
encounters an error.
Contract (Contd.)
Is defined by using the [FaultContract] attribute, as shown
in the following code snippet:
[ServiceContract]
public interface IService
{
[OperationContract]
[FaultContract(typeof(SampleFaultException))]
DataSet GetDetails(int Employee_ID);
}
[DataContract]
public class SampleFaultException
{
[DataMember]
public string errorMessage;
}
Contract (Contd.)
Problem Statement:
Luxury Drive is using an XML Web service that provides the
details about the various models of the cars manufactured by
the company. The Web service is used by the company’s call
center and the distributors. The call center employees use a
client application developed in .NET to access the Web
service. However, the distributors use various applications
having different platforms to access the Web service.
The management at Luxury Drive wants their Web service to
be such that it can accommodate features such as reliable
messaging, transactions, and security in future. The
management has conveyed the same to the developers.
The developers know that they can implement all these
features in the existing XML Web service. However, it would be
difficult because each of these features is provided by different
technologies and merging all these technologies is a time-
consuming and complex task.
Activity 5.1: Creating a WCF Service
Therefore, the developers decided to create the Web service
by using WCF because WCF is the unification of all these
technologies and provides all the required features. You, as a
distributed application developer, have to create a WCF
service that provides the details about the various models of
the cars manufactured by the company.
Prerequisite: You need to use the LuxuryDrive database for
this activity. Ask your faculty to provide you with the database
and the QueryCarDetailsClientApp client application.
Activity 5.1: Creating a WCF Service (Contd.)
Solution:
To create the required WCF service, you need to perform the
following tasks:
1. Create a WCF service.
2. Verify the WCF service.
Activity 5.1: Creating a WCF Service (Contd.)
In this session, you learned that:
WCF is a unified programming model for building
service-oriented applications. It combines the features of all the
distributed technologies, such as:
COM+ services
.NET Remoting
Web services
The fundamentals of WCF are:
Unification
Interoperability
Service orientation
The layers of the WCF architecture are:
Contract
Service runtime
Messaging
Activation and hosting
Summary
An endpoint of a WCF service acts as a gateway for
communicating with other applications.
An endpoint is composed of:
Address
Binding
Contract
An address of the service specifies the location where the
service resides.
Binding describes how a WCF service communicates with a
client application.
Summary (Contd.)
Some of the bindings provided by WCF are:
basicHttpBinding
wsHttpBinding
netTcpBinding
netNamedPipeBinding
netMsmqBinding
netPeerTcpBinding
Contracts specify the content of a message, such as methods
and variables and the functionality provided by a WCF service.
The various types of contracts in a WCF service are:
Service contract
Operation contract
Data contract
Message contract
Fault contract
Summary (Contd.)

More Related Content

PPS
PDF
Flex Rails Pres
PPTX
Web apps architecture
PDF
Ashish tripath
PPT
Flex for enterprise applications
ODP
Java Web Programming [1/9] : Introduction to Web Application
PPTX
Client Object Model - SharePoint Extreme 2012
PPTX
Integrating with LinkedIn using Mule ESB LinkedIn Connector
Flex Rails Pres
Web apps architecture
Ashish tripath
Flex for enterprise applications
Java Web Programming [1/9] : Introduction to Web Application
Client Object Model - SharePoint Extreme 2012
Integrating with LinkedIn using Mule ESB LinkedIn Connector

What's hot (20)

PPT
PPTX
Mule edifact module
DOCX
Unit 1st and 3rd notes of java
PDF
Moving from webservices to wcf services
DOCX
Java unit 4_cs_notes
PDF
Example User Stories Specification for ReqView
PPT
Webapplication ppt prepared by krishna ballabh gupta
DOCX
J2 ee tutorial ejb
PPT
Flex And Java Integration
PDF
Overview of web services
PDF
ESM_ServiceLayer_DevGuide_1.0.pdf
PDF
Chapter1
PPT
Flex And Java Integration
PPT
Web Service Presentation
PPTX
Chapter2 j2ee
PDF
Asp.netrole
PPT
Flex And Ria
PPT
Flex 3 - Introduction
PPTX
Visual Studio 2010 IDE Enhancements - Alex Mackey, Readify
PPT
]project-open[ Extensible Architecture
Mule edifact module
Unit 1st and 3rd notes of java
Moving from webservices to wcf services
Java unit 4_cs_notes
Example User Stories Specification for ReqView
Webapplication ppt prepared by krishna ballabh gupta
J2 ee tutorial ejb
Flex And Java Integration
Overview of web services
ESM_ServiceLayer_DevGuide_1.0.pdf
Chapter1
Flex And Java Integration
Web Service Presentation
Chapter2 j2ee
Asp.netrole
Flex And Ria
Flex 3 - Introduction
Visual Studio 2010 IDE Enhancements - Alex Mackey, Readify
]project-open[ Extensible Architecture
Ad

Viewers also liked (12)

PPS
PPS
PPT
A tour around san vicente de la barquera maria
PPS
Data Structures and Algorithms Unit 01
PPTX
Mari domingiren etorrera
PPT
RDBMS_Unit 01
PPS
C programming unit 01
PPS
J2ME Unit_01
PPS
Web Component Development with Servlet and JSP Technologies Unit 01
PPS
Advanced excel unit 01
PPS
WPF (Windows Presentation Foundation Unit 01)
PPT
VB.Net GUI Unit_01
A tour around san vicente de la barquera maria
Data Structures and Algorithms Unit 01
Mari domingiren etorrera
RDBMS_Unit 01
C programming unit 01
J2ME Unit_01
Web Component Development with Servlet and JSP Technologies Unit 01
Advanced excel unit 01
WPF (Windows Presentation Foundation Unit 01)
VB.Net GUI Unit_01
Ad

Similar to WCF (Windows Communication Foundation_Unit_01) (20)

DOC
WCF tutorial
PPTX
WCF (Windows Communication Foundation)
PPT
WCFPresentation.ppt WCFPresentation.ppt WCFPresentation.ppt
PPT
Dot Net Training Wcf Dot Net35
PPTX
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
PDF
Windows Communication Foundation (WCF)
PPT
PPTX
Web services
PDF
Wcf development
PPTX
1. WCF Services - Exam 70-487
PPTX
Understanding Web Services by software outsourcing company india
PPTX
SOA & WCF
DOCX
Top wcf interview questions
PPTX
Application integration framework & Adaptor ppt
PPT
Session 1 Shanon Richards-Exposing Data Using WCF
PPTX
web programming
PPT
Basics of WCF and its Security
PPTX
Web programming
PDF
Advantage of WCF Over Web Services
WCF tutorial
WCF (Windows Communication Foundation)
WCFPresentation.ppt WCFPresentation.ppt WCFPresentation.ppt
Dot Net Training Wcf Dot Net35
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Windows Communication Foundation (WCF)
Web services
Wcf development
1. WCF Services - Exam 70-487
Understanding Web Services by software outsourcing company india
SOA & WCF
Top wcf interview questions
Application integration framework & Adaptor ppt
Session 1 Shanon Richards-Exposing Data Using WCF
web programming
Basics of WCF and its Security
Web programming
Advantage of WCF Over Web Services

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Spectral efficient network and resource selection model in 5G networks
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Big Data Technologies - Introduction.pptx
PPT
Teaching material agriculture food technology
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Approach and Philosophy of On baking technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Cloud computing and distributed systems.
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
The AUB Centre for AI in Media Proposal.docx
Spectral efficient network and resource selection model in 5G networks
“AI and Expert System Decision Support & Business Intelligence Systems”
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Monthly Chronicles - July 2025
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Big Data Technologies - Introduction.pptx
Teaching material agriculture food technology
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
Review of recent advances in non-invasive hemoglobin estimation
MYSQL Presentation for SQL database connectivity
Approach and Philosophy of On baking technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Understanding_Digital_Forensics_Presentation.pptx

WCF (Windows Communication Foundation_Unit_01)

  • 1. In this session, you will learn to: Identify WCF Explore the programming model of WCF Objectives
  • 2. WCF is a unified programming model for developing service-oriented applications. It combines the features of all the distributed technologies, such as COM+ services, .NET Remoting, and Web services. It enables you to build a secure, reliable, and robust application. It enables two applications to communicate across platforms in a distributed environment. Identifying WCF
  • 3. To understand the architecture of WCF, you should be aware of the following fundamentals of WCF: Unification: WCF enhances the development of distributed applications and increases developer’s productivity by unifying the following technologies: COM+ services .NET Remoting Web services Web Services Enhancements (WSE) Microsoft Message Queuing Interoperability: WCF enables two applications built on the same or different platforms to communicate with each other within or across a network. Fundamentals of WCF
  • 4. Service orientation: WCF provides a highly productive programming model for building distributed systems that involve developing loosely-coupled services. The following figure illustrates the fundamentals of WCF. Fundamentals of WCF (Contd.)
  • 5. The following figure illustrates the architecture of WCF. Architecture of WCF
  • 6. Architecture of WCF (Contd.) The WCF architecture contains the following layers: The contract layer: It contains the various types of contracts, policies, and bindings used in WCF. The various types of contracts present in the contract layer are: The data contract The message contract The service contract
  • 7. Architecture of WCF (Contd.) The service runtime layer: It specifies how the service will behave when it runs or executes. This layer contains the various types of runtime behaviors of the service. These runtime behaviors are: Throttling behavior Error behavior Metadata behavior Instance behavior Message inspection Transaction behavior Dispatch behavior Concurrency behavior Parameter filtering
  • 8. Architecture of WCF (Contd.) The messaging layer: It consists of channels through which a message is processed and transported to a client accessing the service. This layer consists of two types of channels: Transport channels Protocol channels The activation and hosting layer: It supports the execution of services in different environments, such as Windows services, IIS, and Windows Activation Service (WAS). A WCF service can be hosted in various ways. These ways are: Self-hosting IIS Windows service WAS
  • 9. Exploring the Programming Model of WCF All communication with a WCF service occurs through the endpoints of the service. An endpoint of a WCF service acts as a gateway for communicating with other applications. It is composed of an address, a binding, and a contract known as the ABC of endpoint, as shown in the following figure.
  • 10. The address of a WCF service specifies the location where the service resides. It is represented in the form of a URL that defines: The protocol to be used for sending and receiving messages. The name of the system where the service runs. The port number at which the service listens to the client requests. The path where the service resides and the name of the service. The following code snippet shows how you can specify the address of a WCF service: address="http://MyComputer:3577/CarDetailsWCFService /Service.svc" Address
  • 11. It describes how a WCF service communicates with a client application. It specifies the communication details required to connect to the endpoint of a WCF service. It consists of the message encoder and protocol binding element. WCF provides the following types of bindings to enable a client application to communicate with a WCF service: basicHttpBinding wsHttpBinding netTcpBinding netNamedPipeBinding netMsmqBinding netPeerTcpBinding Binding
  • 12. It exposes the interfaces, classes, methods, and variables of a WCF service to enable client applications to access and use them. A WCF service may contain the following types of contracts: Service contract Operation contract Data contract Message contract Fault contract Contract
  • 13. Service Contract: Acts as an entry point to access a WCF service. Is implemented as an interface. Is defined by declaring the [ServiceContract] attribute in a WCF service, as shown in the following code snippet: [ServiceContract] public interface IService { } Contract (Contd.)
  • 14. Operation Contract: Exposes the operations that a service can perform. Defines the methods of a WCF service and the parameters and return types of the methods. Is defined by declaring the [OperationContract] attribute in the WCF service, as shown in the following code snippet: [ServiceContract] public interface IService { [OperationContract] DataSet GetDetails(int Employee_ID); } Contract (Contd.)
  • 15. Data Contract: Is used to expose user-defined data types in a WCF service. Serializes the user-defined data types in a standard format (XML). Is defined by using the [DataContract] attribute in the WCF service, as shown in the following code snippet: [DataContract] public class Employees { [DataMember] public int emp_id; [DataMember] public int emp_name; } Contract (Contd.)
  • 16. Message Contract: Describes the structure of a message exchanged between a WCF service and a client application. Enables you to inspect and control the information contained in a message. Is defined by using the [MessageContract], [MessageBodyMember], and [MessageHeader]attributes, as shown in the following code snippet: [MessageContract] public class StoreMessage { [MessageHeader] public DateTime CurrentTime; [MessageBodyMember] public Employees emp_id; } Contract (Contd.)
  • 17. Fault Contract: Enables you to send a customized error message to a client by creating a user-defined class. Enables you to control the situation when a WCF service encounters an error. Contract (Contd.)
  • 18. Is defined by using the [FaultContract] attribute, as shown in the following code snippet: [ServiceContract] public interface IService { [OperationContract] [FaultContract(typeof(SampleFaultException))] DataSet GetDetails(int Employee_ID); } [DataContract] public class SampleFaultException { [DataMember] public string errorMessage; } Contract (Contd.)
  • 19. Problem Statement: Luxury Drive is using an XML Web service that provides the details about the various models of the cars manufactured by the company. The Web service is used by the company’s call center and the distributors. The call center employees use a client application developed in .NET to access the Web service. However, the distributors use various applications having different platforms to access the Web service. The management at Luxury Drive wants their Web service to be such that it can accommodate features such as reliable messaging, transactions, and security in future. The management has conveyed the same to the developers. The developers know that they can implement all these features in the existing XML Web service. However, it would be difficult because each of these features is provided by different technologies and merging all these technologies is a time- consuming and complex task. Activity 5.1: Creating a WCF Service
  • 20. Therefore, the developers decided to create the Web service by using WCF because WCF is the unification of all these technologies and provides all the required features. You, as a distributed application developer, have to create a WCF service that provides the details about the various models of the cars manufactured by the company. Prerequisite: You need to use the LuxuryDrive database for this activity. Ask your faculty to provide you with the database and the QueryCarDetailsClientApp client application. Activity 5.1: Creating a WCF Service (Contd.)
  • 21. Solution: To create the required WCF service, you need to perform the following tasks: 1. Create a WCF service. 2. Verify the WCF service. Activity 5.1: Creating a WCF Service (Contd.)
  • 22. In this session, you learned that: WCF is a unified programming model for building service-oriented applications. It combines the features of all the distributed technologies, such as: COM+ services .NET Remoting Web services The fundamentals of WCF are: Unification Interoperability Service orientation The layers of the WCF architecture are: Contract Service runtime Messaging Activation and hosting Summary
  • 23. An endpoint of a WCF service acts as a gateway for communicating with other applications. An endpoint is composed of: Address Binding Contract An address of the service specifies the location where the service resides. Binding describes how a WCF service communicates with a client application. Summary (Contd.)
  • 24. Some of the bindings provided by WCF are: basicHttpBinding wsHttpBinding netTcpBinding netNamedPipeBinding netMsmqBinding netPeerTcpBinding Contracts specify the content of a message, such as methods and variables and the functionality provided by a WCF service. The various types of contracts in a WCF service are: Service contract Operation contract Data contract Message contract Fault contract Summary (Contd.)