SlideShare a Scribd company logo
Binu Bhasuran
Microsoft MVP Visual C#
Facebook http://facebook.com/codeno47
Blog http://proxdev.com/
Windows Communication Foundation (WCF) is
Microsoft’s unified programming model for
building service-oriented applications. It
enables developers to build secure, reliable,
transacted solutions that integrate across
platforms and interoperate with existing
investments.
When clients call the service, will they call one
method or more than one method?
If they call more than one method, how much time
elapses between method calls?
If they call more than one method, does the service
need to maintain state between calls?
Will clients call the service frequently or
infrequently?
How many clients at a time will call the service?
Rather than requiring different technologies for
different communication styles, WCF provides a
single unified solution
Reflecting the heterogeneity of most
enterprises, WCF is designed to interoperate
well with the non-WCF world.
There are two important aspects of this:
interoperability with platforms created by other
vendors, and interoperability with the Microsoft
technologies that preceded WCF.
WCF-based applications running in a different
process on the same Windows machine
WCF-based applications running on another
Windows machine
Applications built on other technologies, such
as Java EE application servers, that support
standard Web services. These applications can
be running on Windows machines or on
machines running other operating systems, such
as Sun Solaris, IBM z/OS, or Linux.
Share schema, not class. Unlike older
distributed object technologies, services
interact with their clients only through a well-
defined XML interface. Behaviors such as
passing complete classes, methods and all,
across service boundaries aren’t allowed.
Services are autonomous. A service and its clients
agree on the interface between them, but are
otherwise independent. They may be written in
different languages, use different runtime
environments, such as the CLR and the Java Virtual
Machine, execute on different operating systems,
and differ in other ways.
A service class, implemented in C# or Visual
Basic or another CLR-based language, that
implements one or more methods.
A host process in which the service runs.
One or more endpoints that allow clients to
access the service. All communication with a
WCF service happens via the service’s
endpoints.
A service class is a class like any other, but it has a
few additions. These additions allow the class’s
creator to define one or more contracts that this
class implements.
Each service class implements at least one service
contract, which defines the operations this service
exposes.
The class might also provide an explicit data
contract, which defines the data those operations
convey.
Every service class implements methods for its
clients to use.
The creator of the class determines which of its
methods are exposed as client-callable
operations by specifying that they are part of
some service contract.
To do this, a developer uses the WCF-defined
attribute ServiceContract.
using System.ServiceModel;
[ServiceContract]
class RentalReservations
{
[OperationContract]
public bool Check(int vehicleClass, int location,
string dates)
{
bool availability;
// code to check availability goes here
return availability;
}
[OperationContract]
public int Reserve(int vehicleClass, int location,
string dates)
{
int confirmationNumber;
// code to reserve rental car goes here
return confirmationNumber;
}
[OperationContract]
public bool Cancel(int confirmationNumber)
{
bool success;
// code to cancel reservation goes here
return success;
}
public int GetStats()
{
int numberOfReservations;
// code to get the current reservation count goes here
return numberOfReservations;
}
}
A WCF service class specifies a service contract
defining which of its methods are exposed to
clients of that service.
Each of those operations will typically convey some
data, which means that a service contract also
implies some kind of data contract describing the
information that will be exchanged.
In some cases, this data contract is defined
implicitly as part of the service contract.
using System.Runtime.Serialization;
[DataContract]
struct ReservationInfo {
[DataMember] public int vehicleClass;
[DataMember] public int location;
[DataMember] public string dates;
}
A WCF service class is typically compiled into a
library. By definition, all libraries need a host
Windows process to run in.
WCF provides two main options for hosting
libraries that implement services.
One is to use a host process created by either
Internet Information Services (IIS) or a related
technology called the Windows Activation Service
(WAS).
The other allows a service to be hosted in an
arbitrary process.
The simplest way to host a WCF service is to rely
on IIS or WAS. Both rely on the notion of a
virtual directory, which is just a shorter alias for
an actual directory path in the Windows file
system.
<%@Service language=c#
class="RentalReservations" %>
using System.ServiceModel;
public class ReservationHost
{
public static void Main()
{
ServiceHost s =
new ServiceHost(typeof(RentalReservations));
s.Open();
Console.Writeline("Press ENTER to end service");
Console.Readline();
s.Close();
}
}
An address indicating where this endpoint can be
found. Addresses are URLs that identify a machine
and a particular endpoint on that machine.
A binding determining how this endpoint can be
accessed. The binding determines what protocol
combination can be used to access this endpoint
along with other things, such as whether the
communication is reliable and what security
mechanisms can be used.
A contract name indicating which service contract
this WCF service class exposes via this endpoint. A
class marked with ServiceContract that implements
no explicit interfaces, such as RentalReservations in
the first example shown earlier, can expose only
one service contract.
In this case, all its endpoints will expose the same
contract. If a class explicitly implements two or
more interfaces marked with ServiceContract,
however, different endpoints can expose different
contracts, each defined by a different interface.
BasicHttpBinding: Conforms to the Web Services Interoperability Organization (WS-I) Basic Profiles 1.2
and 2.0, which specify SOAP over HTTP. This binding also supports other options, such as using HTTPS
as specified by the WS-I Basic Security Profile 1.1 and optimizing data transmission using MTOM.
WsHttpBinding: Uses SOAP over HTTP, like BasicProfileBinding, but also supports reliable message
transfer with WS-ReliableMessaging, security with WS-Security, and transactions with WS-
AtomicTransaction. This binding allows interoperability with other Web services implementations that
also support these specifications.
NetTcpBinding: Sends binary-encoded SOAP, including support for reliable message transfer, security,
and transactions, directly over TCP. This binding can be used only for WCF-to-WCF communication.
WebHttpBinding: Sends information directly over HTTP or HTTPS—no SOAP envelope is created. This
binding first appeared in the .NET Framework 3.5 version of WCF, and it’s the right choice for RESTful
communication and other situations where SOAP isn’t required. The binding offers three options for
representing content: text-based XML, JavaScript Object Notation (JSON), and opaque binary encoding.
NetNamedPipesBinding: Sends binary-encoded SOAP over named pipes. This binding is only usable for
WCF-to-WCF communication between processes on the same machine.
NetMsmqBinding: Sends binary-encoded SOAP over MSMQ, as described later in this paper. This
binding can only be used for WCF-to-WCF communication.
public static void Main()
{
ServiceHost s =
new ServiceHost(typeof(RentalReservations));
s.AddEndpoint(typeof(RentalReservations),
new BasicHttpBinding(),
"http://www.fabrikam.com/reservation/reserve.svc");
s.Open();
Console.Writeline("Press ENTER to end service");
Console.Readline();
s.Close();
}
<configuration>
<system.serviceModel>
<services>
<service type="RentalReservations,RentalApp">
<endpoint
contract="IReservations"
binding=”basicHttpBinding”
address=
"http://www.fabrikam.com/reservation/reserve.svc"/>
</service>
</services>
</system.serviceModel>
</configuration>
using System.ServiceModel;
public class RentalReservationsClient
{
public static void Main()
{
int confirmationNum;
RentalReservationsProxy p = new RentalReservationsProxy();
if (p.Check(1, 349, “9/30/09-10/10/09”)) {
confirmationNum = p.Reserve(1, 349, “9/30/09-10/10/09”);
}
p.Close();
}
}
http://msdn.microsoft.com/en-us/netframework/first-steps-with-wcf.aspx
Wcf development
Wcf development

More Related Content

What's hot

Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
Peter R. Egli
 
WCF Introduction
WCF IntroductionWCF Introduction
WCF Introduction
Mohamed Zakarya Abdelgawad
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overview
Arbind Tiwari
 
WCF
WCFWCF
WCF And ASMX Web Services
WCF And ASMX Web ServicesWCF And ASMX Web Services
WCF And ASMX Web Services
Manny Siddiqui MCS, MBA, PMP
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0
Saltmarch Media
 
Interoperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewInteroperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewJorgen Thelin
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCF
ybbest
 
Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) Service
Sj Lim
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
Abhi Arya
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Story
ukdpe
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487Bat Programmer
 
Web services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsWeb services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows Forms
Peter Gfader
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questions
tongdang
 
Session 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCFSession 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCF
Code Mastery
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & RESTSanthu Rao
 

What's hot (20)

Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
WCF Introduction
WCF IntroductionWCF Introduction
WCF Introduction
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overview
 
WCF
WCFWCF
WCF
 
WCF And ASMX Web Services
WCF And ASMX Web ServicesWCF And ASMX Web Services
WCF And ASMX Web Services
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0
 
Interoperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewInteroperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) Overview
 
WCF
WCFWCF
WCF
 
WCF for begineers
WCF  for begineersWCF  for begineers
WCF for begineers
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCF
 
Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) Service
 
Windows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best PracticesWindows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best Practices
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Story
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487
 
Web services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows FormsWeb services, WCF services and Multi Threading with Windows Forms
Web services, WCF services and Multi Threading with Windows Forms
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questions
 
Session 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCFSession 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCF
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & REST
 

Viewers also liked

WCF 4.0
WCF 4.0WCF 4.0
WCF 4.0
Eyal Vardi
 
Advanced WCF Workshop
Advanced WCF WorkshopAdvanced WCF Workshop
Advanced WCF Workshop
Ido Flatow
 
Model view view model
Model view view modelModel view view model
Model view view model
Binu Bhasuran
 
.Net platform an understanding
.Net platform an understanding.Net platform an understanding
.Net platform an understanding
Binu Bhasuran
 
Wcf Transaction Handling
Wcf Transaction HandlingWcf Transaction Handling
Wcf Transaction Handling
Gaurav Arora
 
Wcf for the web developer
Wcf for the web developerWcf for the web developer
Wcf for the web developer
Codecamp Romania
 
Angularjs interview questions and answers
Angularjs interview questions and answersAngularjs interview questions and answers
Angularjs interview questions and answers
prasaddammalapati
 
Angular.js interview questions
Angular.js interview questionsAngular.js interview questions
Angular.js interview questions
codeandyou forums
 
2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal
Adil Mughal
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web APIhabib_786
 
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 days
Udaya Kumar
 
The ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersThe ASP.NET Web API for Beginners
The ASP.NET Web API for Beginners
Kevin Hazzard
 

Viewers also liked (19)

WCF 4.0
WCF 4.0WCF 4.0
WCF 4.0
 
Advanced WCF Workshop
Advanced WCF WorkshopAdvanced WCF Workshop
Advanced WCF Workshop
 
Model view view model
Model view view modelModel view view model
Model view view model
 
.Net platform an understanding
.Net platform an understanding.Net platform an understanding
.Net platform an understanding
 
An Overview Of Wpf
An Overview Of WpfAn Overview Of Wpf
An Overview Of Wpf
 
Excellent rest met de web api
Excellent rest met de web apiExcellent rest met de web api
Excellent rest met de web api
 
Wcf Transaction Handling
Wcf Transaction HandlingWcf Transaction Handling
Wcf Transaction Handling
 
Advanced WCF
Advanced WCFAdvanced WCF
Advanced WCF
 
Treeview listview
Treeview listviewTreeview listview
Treeview listview
 
Wcf for the web developer
Wcf for the web developerWcf for the web developer
Wcf for the web developer
 
Angularjs interview questions and answers
Angularjs interview questions and answersAngularjs interview questions and answers
Angularjs interview questions and answers
 
Angular.js interview questions
Angular.js interview questionsAngular.js interview questions
Angular.js interview questions
 
2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal2 Day - WPF Training by Adil Mughal
2 Day - WPF Training by Adil Mughal
 
Active x
Active xActive x
Active x
 
Threads c sharp
Threads c sharpThreads c sharp
Threads c sharp
 
Ch 7 data binding
Ch 7 data bindingCh 7 data binding
Ch 7 data binding
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
WPF For Beginners - Learn in 3 days
WPF For Beginners  - Learn in 3 daysWPF For Beginners  - Learn in 3 days
WPF For Beginners - Learn in 3 days
 
The ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersThe ASP.NET Web API for Beginners
The ASP.NET Web API for Beginners
 

Similar to Wcf development

Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Subodh Pushpak
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its Security
Mindfire Solutions
 
Advantage of WCF Over Web Services
Advantage of WCF Over Web ServicesAdvantage of WCF Over Web Services
Advantage of WCF Over Web Services
Siva Tharun Kola
 
WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)
Prashanth Shivakumar
 
Web services
Web servicesWeb services
Web servicesaspnet123
 
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Jason Townsend, MBA
 
Wcf and its features
Wcf and its featuresWcf and its features
Wcf and its featuresGulshan Sam
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003
Jason Townsend, MBA
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication FoundationMahmoud Tolba
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
Jignesh Aakoliya
 
Web programming
Web programmingWeb programming
Web programming
sowfi
 
SOA & WCF
SOA & WCFSOA & WCF
SOA & WCF
Dev Raj Gautam
 
Dealing with Diversity: Understanding WCF Communication Options in ...
Dealing with Diversity: Understanding WCF Communication Options in ...Dealing with Diversity: Understanding WCF Communication Options in ...
Dealing with Diversity: Understanding WCF Communication Options in ...butest
 
Service Oriented Development With Windows Communication Foundation Tulsa Dnug
Service Oriented Development With Windows Communication Foundation   Tulsa DnugService Oriented Development With Windows Communication Foundation   Tulsa Dnug
Service Oriented Development With Windows Communication Foundation Tulsa Dnug
Jason Townsend, MBA
 
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Jorgen Thelin
 
Web Service Security
Web Service SecurityWeb Service Security
Web Service Security
n|u - The Open Security Community
 
Wcf faq
Wcf faqWcf faq
Wcf faq
Rajoo Jha
 
Semantic Web Services (Standards, Monitoring, Testing and Security)
Semantic Web Services  (Standards, Monitoring, Testing and Security)Semantic Web Services  (Standards, Monitoring, Testing and Security)
Semantic Web Services (Standards, Monitoring, Testing and Security)Reza Gh
 
Xml web services
Xml web servicesXml web services
Xml web servicesRaghu nath
 
Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...
Abdul Khan
 

Similar to Wcf development (20)

Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its Security
 
Advantage of WCF Over Web Services
Advantage of WCF Over Web ServicesAdvantage of WCF Over Web Services
Advantage of WCF Over Web Services
 
WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)
 
Web services
Web servicesWeb services
Web services
 
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
 
Wcf and its features
Wcf and its featuresWcf and its features
Wcf and its features
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
Web programming
Web programmingWeb programming
Web programming
 
SOA & WCF
SOA & WCFSOA & WCF
SOA & WCF
 
Dealing with Diversity: Understanding WCF Communication Options in ...
Dealing with Diversity: Understanding WCF Communication Options in ...Dealing with Diversity: Understanding WCF Communication Options in ...
Dealing with Diversity: Understanding WCF Communication Options in ...
 
Service Oriented Development With Windows Communication Foundation Tulsa Dnug
Service Oriented Development With Windows Communication Foundation   Tulsa DnugService Oriented Development With Windows Communication Foundation   Tulsa Dnug
Service Oriented Development With Windows Communication Foundation Tulsa Dnug
 
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
 
Web Service Security
Web Service SecurityWeb Service Security
Web Service Security
 
Wcf faq
Wcf faqWcf faq
Wcf faq
 
Semantic Web Services (Standards, Monitoring, Testing and Security)
Semantic Web Services  (Standards, Monitoring, Testing and Security)Semantic Web Services  (Standards, Monitoring, Testing and Security)
Semantic Web Services (Standards, Monitoring, Testing and Security)
 
Xml web services
Xml web servicesXml web services
Xml web services
 
Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...
 

More from Binu Bhasuran

Asp.net web api
Asp.net web apiAsp.net web api
Asp.net web api
Binu Bhasuran
 
Design patterns fast track
Design patterns fast trackDesign patterns fast track
Design patterns fast track
Binu Bhasuran
 
Microsoft Azure solutions - Whitepaper
Microsoft Azure solutions - WhitepaperMicrosoft Azure solutions - Whitepaper
Microsoft Azure solutions - Whitepaper
Binu Bhasuran
 
C# Basics
C# BasicsC# Basics
C# Basics
Binu Bhasuran
 
Microsoft Managed Extensibility Framework
Microsoft Managed Extensibility FrameworkMicrosoft Managed Extensibility Framework
Microsoft Managed Extensibility Framework
Binu Bhasuran
 
Restful Services With WFC
Restful Services With WFCRestful Services With WFC
Restful Services With WFC
Binu Bhasuran
 
Design patterns
Design patternsDesign patterns
Design patterns
Binu Bhasuran
 
Moving from webservices to wcf services
Moving from webservices to wcf servicesMoving from webservices to wcf services
Moving from webservices to wcf services
Binu Bhasuran
 
Asynchronous programming in .net 4.5 with c#
Asynchronous programming in .net 4.5 with c#Asynchronous programming in .net 4.5 with c#
Asynchronous programming in .net 4.5 with c#Binu Bhasuran
 

More from Binu Bhasuran (10)

Asp.net web api
Asp.net web apiAsp.net web api
Asp.net web api
 
Design patterns fast track
Design patterns fast trackDesign patterns fast track
Design patterns fast track
 
Microsoft Azure solutions - Whitepaper
Microsoft Azure solutions - WhitepaperMicrosoft Azure solutions - Whitepaper
Microsoft Azure solutions - Whitepaper
 
C# Basics
C# BasicsC# Basics
C# Basics
 
Microsoft Managed Extensibility Framework
Microsoft Managed Extensibility FrameworkMicrosoft Managed Extensibility Framework
Microsoft Managed Extensibility Framework
 
Restful Services With WFC
Restful Services With WFCRestful Services With WFC
Restful Services With WFC
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Biz talk
Biz talkBiz talk
Biz talk
 
Moving from webservices to wcf services
Moving from webservices to wcf servicesMoving from webservices to wcf services
Moving from webservices to wcf services
 
Asynchronous programming in .net 4.5 with c#
Asynchronous programming in .net 4.5 with c#Asynchronous programming in .net 4.5 with c#
Asynchronous programming in .net 4.5 with c#
 

Recently uploaded

A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 

Recently uploaded (20)

A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 

Wcf development

  • 1. Binu Bhasuran Microsoft MVP Visual C# Facebook http://facebook.com/codeno47 Blog http://proxdev.com/
  • 2. Windows Communication Foundation (WCF) is Microsoft’s unified programming model for building service-oriented applications. It enables developers to build secure, reliable, transacted solutions that integrate across platforms and interoperate with existing investments.
  • 3.
  • 4. When clients call the service, will they call one method or more than one method? If they call more than one method, how much time elapses between method calls? If they call more than one method, does the service need to maintain state between calls? Will clients call the service frequently or infrequently? How many clients at a time will call the service?
  • 5.
  • 6.
  • 7. Rather than requiring different technologies for different communication styles, WCF provides a single unified solution
  • 8. Reflecting the heterogeneity of most enterprises, WCF is designed to interoperate well with the non-WCF world. There are two important aspects of this: interoperability with platforms created by other vendors, and interoperability with the Microsoft technologies that preceded WCF.
  • 9. WCF-based applications running in a different process on the same Windows machine WCF-based applications running on another Windows machine
  • 10. Applications built on other technologies, such as Java EE application servers, that support standard Web services. These applications can be running on Windows machines or on machines running other operating systems, such as Sun Solaris, IBM z/OS, or Linux.
  • 11.
  • 12.
  • 13. Share schema, not class. Unlike older distributed object technologies, services interact with their clients only through a well- defined XML interface. Behaviors such as passing complete classes, methods and all, across service boundaries aren’t allowed.
  • 14. Services are autonomous. A service and its clients agree on the interface between them, but are otherwise independent. They may be written in different languages, use different runtime environments, such as the CLR and the Java Virtual Machine, execute on different operating systems, and differ in other ways.
  • 15. A service class, implemented in C# or Visual Basic or another CLR-based language, that implements one or more methods. A host process in which the service runs. One or more endpoints that allow clients to access the service. All communication with a WCF service happens via the service’s endpoints.
  • 16.
  • 17. A service class is a class like any other, but it has a few additions. These additions allow the class’s creator to define one or more contracts that this class implements. Each service class implements at least one service contract, which defines the operations this service exposes. The class might also provide an explicit data contract, which defines the data those operations convey.
  • 18. Every service class implements methods for its clients to use. The creator of the class determines which of its methods are exposed as client-callable operations by specifying that they are part of some service contract. To do this, a developer uses the WCF-defined attribute ServiceContract.
  • 19. using System.ServiceModel; [ServiceContract] class RentalReservations { [OperationContract] public bool Check(int vehicleClass, int location, string dates) { bool availability; // code to check availability goes here return availability; }
  • 20. [OperationContract] public int Reserve(int vehicleClass, int location, string dates) { int confirmationNumber; // code to reserve rental car goes here return confirmationNumber; } [OperationContract] public bool Cancel(int confirmationNumber) { bool success; // code to cancel reservation goes here return success; } public int GetStats() { int numberOfReservations; // code to get the current reservation count goes here return numberOfReservations; } }
  • 21. A WCF service class specifies a service contract defining which of its methods are exposed to clients of that service. Each of those operations will typically convey some data, which means that a service contract also implies some kind of data contract describing the information that will be exchanged. In some cases, this data contract is defined implicitly as part of the service contract.
  • 22. using System.Runtime.Serialization; [DataContract] struct ReservationInfo { [DataMember] public int vehicleClass; [DataMember] public int location; [DataMember] public string dates; }
  • 23. A WCF service class is typically compiled into a library. By definition, all libraries need a host Windows process to run in. WCF provides two main options for hosting libraries that implement services. One is to use a host process created by either Internet Information Services (IIS) or a related technology called the Windows Activation Service (WAS). The other allows a service to be hosted in an arbitrary process.
  • 24. The simplest way to host a WCF service is to rely on IIS or WAS. Both rely on the notion of a virtual directory, which is just a shorter alias for an actual directory path in the Windows file system. <%@Service language=c# class="RentalReservations" %>
  • 25. using System.ServiceModel; public class ReservationHost { public static void Main() { ServiceHost s = new ServiceHost(typeof(RentalReservations)); s.Open(); Console.Writeline("Press ENTER to end service"); Console.Readline(); s.Close(); } }
  • 26. An address indicating where this endpoint can be found. Addresses are URLs that identify a machine and a particular endpoint on that machine. A binding determining how this endpoint can be accessed. The binding determines what protocol combination can be used to access this endpoint along with other things, such as whether the communication is reliable and what security mechanisms can be used.
  • 27. A contract name indicating which service contract this WCF service class exposes via this endpoint. A class marked with ServiceContract that implements no explicit interfaces, such as RentalReservations in the first example shown earlier, can expose only one service contract. In this case, all its endpoints will expose the same contract. If a class explicitly implements two or more interfaces marked with ServiceContract, however, different endpoints can expose different contracts, each defined by a different interface.
  • 28. BasicHttpBinding: Conforms to the Web Services Interoperability Organization (WS-I) Basic Profiles 1.2 and 2.0, which specify SOAP over HTTP. This binding also supports other options, such as using HTTPS as specified by the WS-I Basic Security Profile 1.1 and optimizing data transmission using MTOM. WsHttpBinding: Uses SOAP over HTTP, like BasicProfileBinding, but also supports reliable message transfer with WS-ReliableMessaging, security with WS-Security, and transactions with WS- AtomicTransaction. This binding allows interoperability with other Web services implementations that also support these specifications. NetTcpBinding: Sends binary-encoded SOAP, including support for reliable message transfer, security, and transactions, directly over TCP. This binding can be used only for WCF-to-WCF communication. WebHttpBinding: Sends information directly over HTTP or HTTPS—no SOAP envelope is created. This binding first appeared in the .NET Framework 3.5 version of WCF, and it’s the right choice for RESTful communication and other situations where SOAP isn’t required. The binding offers three options for representing content: text-based XML, JavaScript Object Notation (JSON), and opaque binary encoding. NetNamedPipesBinding: Sends binary-encoded SOAP over named pipes. This binding is only usable for WCF-to-WCF communication between processes on the same machine. NetMsmqBinding: Sends binary-encoded SOAP over MSMQ, as described later in this paper. This binding can only be used for WCF-to-WCF communication.
  • 29.
  • 30. public static void Main() { ServiceHost s = new ServiceHost(typeof(RentalReservations)); s.AddEndpoint(typeof(RentalReservations), new BasicHttpBinding(), "http://www.fabrikam.com/reservation/reserve.svc"); s.Open(); Console.Writeline("Press ENTER to end service"); Console.Readline(); s.Close(); }
  • 32.
  • 33. using System.ServiceModel; public class RentalReservationsClient { public static void Main() { int confirmationNum; RentalReservationsProxy p = new RentalReservationsProxy(); if (p.Check(1, 349, “9/30/09-10/10/09”)) { confirmationNum = p.Reserve(1, 349, “9/30/09-10/10/09”); } p.Close(); } }
  • 34.