SlideShare uma empresa Scribd logo
1 de 22
Windows Communication
     Foundation


               Vijay Krishna Parasi
AGENDA
•   Why WCF Service & SOA Architecture
•   ABC’s of WCF
•   Hosting
•   MEX Endpoint
•   Contracts
    – WSDL
    – SOAP
SOA Architecture Example
ABC’s

            Letter




  Where       How           What       PostBox
(Address)   (Binding)     (Contract)



                End
               Point
Address : “the Where”
– Where the network messages should be sent.

HTTP:
   http://myserver/myservice

TCP:
   net.tcp://myserver:8080/myservice
Binding : “the How”
– How the messages should sent.

– Defines the channel used to communicate with an
  endpoint.

– Channels will have series of binding elements.

– The lowest level of binding element is Transport.

– The built in transport protocols are HTTP, TCP, Named
  Pipes etc…
Contract : “the What”
– Defines capability of endpoint.

– Defines the operations that endpoint exposes.

– Also defines the message formats that the operations
  require.

– They maps to the class methods that endpoints.
WCF Service

                                               End Point

                            Messages
           WCF Client                          End Point

                                               End Point




Service:
   Can have more than one end points.

   Listens for messages on the address specified by the endpoint(s).

   Expects the messages to arrive in specified format.
Hosting

– To make service up and running.

– And to make service respond to the client requests.

– Hosting can be anything Console App, Web Application,
  IIS etc...

– Hosting in IIS requires svc file.
Metadata Exchange (MEX) Endpoint
– For Service Discoverability.

– Helps the clients to obtain the information of ABC’s in the form of
  WSDL (Web Service Description Language).

– When user clicks on Add Service Reference or use svcutil.exe, MEX
  endpoint will be called.

– Client gets WSDL  Below artifacts will be generated
   • Proxy class in the language of the project.
   • Application configuration file

– To configure MEX Endpoint,
   • Enable the “HTTP Get” behavior. Allows the user to access MEX endpoint via
     browser.
   • Add a MEX endpoint including the other endpoints.
WCF Service

                                                  End Point

                             Messages
        WCF Client                                End Point

                                                  End Point




                                                              MEX End Point




MEX Endpoint:
  Must for a service to expose ABC’s to client.
Calling WCF Service from Client
– Can be called in two ways
   • Channels - Using Custom Code
   • Svcutil.exe Using Tools

– Channels:
   • Interface definition is shared b/w the client & service.
   • Client creates a ChannelFactory class to create a channel
     using ABC’s.
   • Using the channel object client calls the service methods.

– Svcutil.exe
   • Add Service Reference from Visual Studio.
   • Internally calls the svcutil.exe
DEMO
– Implementing a WCF service includes.
   • Implement a .NET class
   • Decorate the class with System.ServiceModel attributes.

– System.ServiceModel namespace will be installed
  with.NET 3.0

– WCF Service can be implemented,
   • Writing entirely in Code
   • Writing in Code & Configuration files
If we specify an address in the endpoint it overrides the
base address.
– ServiceContract
   • Marks a class as Contract.
   • Expressed in standards based on WSDL.


– OperationContract
   • Defines methods that can be invoked on the class.
   • Defines the messages that are passed to and from service
     methods.
   • Operations & Messages


– Within the Endpoint definition we will specify the
  Address, Binding & Contract.
– When service is started by host
   • WCF starts the listener listens incoming requests on the
     configured address.
   • In case of IIS hosting, the listener is likely already started, WCF
     registers its listener with IIS.


– When a message arrives, the service host
   • First, based on the channel stack defined by binding it applies
     decompression, decryption and security rules.
   • Second, based on the contract it deserializes the incoming
     message into .NET types and invokes the proper operation.
Once again ABC’s
– Each endpoint constitute ABC’s
   • An addressable location on the network where messages are sent.
   • A binding that describes how messages are sent.
   • A contract that describes the message formats.
Let’s understand “Contracts”
– Contract is binding agreement
   • B/w parties that specifies the supply of goods or services for a
     known price.
   • In WCF context, it’s an agreement between parties that specifies
     the message that can be exchanged based on the terms and
     conditions.
– Description of the messages that are passed to and from
  service endpoints.

– Endpoint must specify the operations it implement and the
  data formats it expect. These specifications make up the
  Contract.
– Types of Contracts:
   • Service Contracts
   • Data Contracts
   • Message Contracts

– Systems should interoperate, so we need a common
  platform. So WSDL is chosen.
   • Its an XML grammar defines the functionality offered by a
     service and the format of messages.
   • Defines what services (operations) are available in service.
   • It defines the methods, parameter names, parameter data
     types and return data types.

– SOAP – Simple Object Access Protocol
   • Communication protocol
   • Format for sending messages
.NET Types  XML          XML  .NET Types

.NET CLR
  Types

                                                      WCF Service inside Host


WCF Client                                         End Points
                                                                        WCF
                                                           Message     Service
                                                           Handler




– How Contracts convert to CLR Types – 3 stage process
     • Client query the service to know ABC’s (endpoints).
     • This raises the metadata infrastructure on the service to
       generate WSDL and finally the proxy class.
     • Finally at runtime, when client calls the service the .NET types
       are serialized into XML and sends over wire.
– Service Contracts:
   • They define the operations performed by service.
   • Two Types
      – ServiceContract
      – OperationContract
   • ServiceContract
      – Define the Interface.
   • OperationContract
      – Define the methods inside interface.
   • By mentioning the [ServiceContract] & [OperationContract]
     they will be exposed in WSDL.
– Data Contracts:
   • They define which data types are passed to and from service.
   • WCF defines implicit contracts for built-in types such as int and
     string.
   • Can easily define explicit opt-in data contracts for custom types
   • Two Types
      – DataContract
      – DataMember
   • DataContract
      – Define which calls should be represent in XSD and include in WSDL.
   • DataMember
      – Define which class members should be represent in XSD and include in
        WSDL.
   • At runtime, the DataContractSerializer class serializes objects
     to XML using the rules defined in [DataContract] &
     [DataMember].
– Message Contracts:
  • Allows the service to interact directly with messages.
  • Describe the structure of SOAP messages sent to and from a
    service.
  • Gives complete control over the SOAP message sent to and from
    a service by providing access to the SOAP headers and bodies
    directly.
  • They define which data types are passed to and from service.
  • WCF defines implicit contracts for built-in types such as int and
    string.
  • Can easily define explicit opt-in data contracts for custom types
  • Two Types
     – DataContract
     – DataMember
  • DataContract
     – Define which calls should be represent in XSD and include in WSDL.

Mais conteúdo relacionado

Mais procurados

REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5Rob Windsor
 
WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)ipower softwares
 
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
 
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 2003Jason Townsend, MBA
 
Java Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAPJava Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAPIMC Institute
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & RESTSanthu Rao
 
introduction to Windows Comunication Foundation
introduction to Windows Comunication Foundationintroduction to Windows Comunication Foundation
introduction to Windows Comunication Foundationredaxe12
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCFybbest
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questionstongdang
 
Java Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIJava Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIIMC Institute
 

Mais procurados (20)

Wcf
WcfWcf
Wcf
 
REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5REST, JSON and RSS with WCF 3.5
REST, JSON and RSS with WCF 3.5
 
WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)
 
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...
 
Web service introduction 2
Web service introduction 2Web service introduction 2
Web service introduction 2
 
Wcf faq
Wcf faqWcf faq
Wcf faq
 
WCF
WCFWCF
WCF
 
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
 
WCF Fundamentals
WCF Fundamentals WCF Fundamentals
WCF Fundamentals
 
Java Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAPJava Web Services [2/5]: Introduction to SOAP
Java Web Services [2/5]: Introduction to SOAP
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & REST
 
introduction to Windows Comunication Foundation
introduction to Windows Comunication Foundationintroduction to Windows Comunication Foundation
introduction to Windows Comunication Foundation
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCF
 
AMQP 1.0 introduction
AMQP 1.0 introductionAMQP 1.0 introduction
AMQP 1.0 introduction
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questions
 
WCF
WCFWCF
WCF
 
WCF And ASMX Web Services
WCF And ASMX Web ServicesWCF And ASMX Web Services
WCF And ASMX Web Services
 
Java Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDIJava Web Services [3/5]: WSDL, WADL and UDDI
Java Web Services [3/5]: WSDL, WADL and UDDI
 
Windows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best PracticesWindows Communication Foundation (WCF) Best Practices
Windows Communication Foundation (WCF) Best Practices
 
Soa unit iv
Soa unit ivSoa unit iv
Soa unit iv
 

Destaque

Windows 8 product guide developer english
Windows 8 product guide developer englishWindows 8 product guide developer english
Windows 8 product guide developer englishHoangminh Nguyen
 
C:\fakepath\marras classico finale
C:\fakepath\marras classico finaleC:\fakepath\marras classico finale
C:\fakepath\marras classico finaleGiulia Lucini
 
Nghiên cứu công nghệ Unity và xây dựng ứng dụng game 3D trên Mobile - My Proj...
Nghiên cứu công nghệ Unity và xây dựng ứng dụng game 3D trên Mobile - My Proj...Nghiên cứu công nghệ Unity và xây dựng ứng dụng game 3D trên Mobile - My Proj...
Nghiên cứu công nghệ Unity và xây dựng ứng dụng game 3D trên Mobile - My Proj...Hoangminh Nguyen
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Peter R. Egli
 
Embedding Employee Engagement throughout the Employee Lifecycle
Embedding Employee Engagement throughout the Employee LifecycleEmbedding Employee Engagement throughout the Employee Lifecycle
Embedding Employee Engagement throughout the Employee LifecycleElizabeth Lupfer
 
How People Really Hold and Touch (their Phones)
How People Really Hold and Touch (their Phones)How People Really Hold and Touch (their Phones)
How People Really Hold and Touch (their Phones)Steven Hoober
 
The History of SEO
The History of SEOThe History of SEO
The History of SEOHubSpot
 

Destaque (11)

Windows service
Windows serviceWindows service
Windows service
 
Windows 8 product guide developer english
Windows 8 product guide developer englishWindows 8 product guide developer english
Windows 8 product guide developer english
 
C:\fakepath\marras classico finale
C:\fakepath\marras classico finaleC:\fakepath\marras classico finale
C:\fakepath\marras classico finale
 
WFC #1
WFC #1WFC #1
WFC #1
 
Nghiên cứu công nghệ Unity và xây dựng ứng dụng game 3D trên Mobile - My Proj...
Nghiên cứu công nghệ Unity và xây dựng ứng dụng game 3D trên Mobile - My Proj...Nghiên cứu công nghệ Unity và xây dựng ứng dụng game 3D trên Mobile - My Proj...
Nghiên cứu công nghệ Unity và xây dựng ứng dụng game 3D trên Mobile - My Proj...
 
What is news?
What is news?What is news?
What is news?
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Embedding Employee Engagement throughout the Employee Lifecycle
Embedding Employee Engagement throughout the Employee LifecycleEmbedding Employee Engagement throughout the Employee Lifecycle
Embedding Employee Engagement throughout the Employee Lifecycle
 
The Minimum Loveable Product
The Minimum Loveable ProductThe Minimum Loveable Product
The Minimum Loveable Product
 
How People Really Hold and Touch (their Phones)
How People Really Hold and Touch (their Phones)How People Really Hold and Touch (their Phones)
How People Really Hold and Touch (their Phones)
 
The History of SEO
The History of SEOThe History of SEO
The History of SEO
 

Semelhante a Windows Communication Foundation

Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Subodh Pushpak
 
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 WCFCode Mastery
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorialAbhi Arya
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487Bat Programmer
 
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
 
Windows communication foundation (part2) jaliya udagedara
Windows communication foundation (part2) jaliya udagedaraWindows communication foundation (part2) jaliya udagedara
Windows communication foundation (part2) jaliya udagedaraJaliya Udagedara
 
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 & SOAPUIAdvancio
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its SecurityMindfire Solutions
 
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 indiaJignesh Aakoliya
 
Birds Of The Same Feather   Biz Talk Server And Wcf
Birds Of The Same Feather    Biz Talk Server And WcfBirds Of The Same Feather    Biz Talk Server And Wcf
Birds Of The Same Feather   Biz Talk Server And Wcfrsnarayanan
 
complete web service1.ppt
complete web service1.pptcomplete web service1.ppt
complete web service1.pptDr.Saranya K.G
 
Web programming
Web programmingWeb programming
Web programmingsowfi
 
Windows communication foundation ii
Windows communication foundation iiWindows communication foundation ii
Windows communication foundation iiSwamy Gowtham
 
Web services
Web servicesWeb services
Web servicesaspnet123
 
Developing and Hosting SOAP Based Services
Developing and Hosting SOAP Based ServicesDeveloping and Hosting SOAP Based Services
Developing and Hosting SOAP Based ServicesStephenKardian
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.pptShivaangiKrish
 
Biztalk ESB Toolkit Introduction
Biztalk ESB Toolkit IntroductionBiztalk ESB Toolkit Introduction
Biztalk ESB Toolkit IntroductionSaffi Ali
 
RabbitMQ and AMQP with .net client library
RabbitMQ and AMQP with .net client libraryRabbitMQ and AMQP with .net client library
RabbitMQ and AMQP with .net client libraryMohammed Shaban
 

Semelhante a Windows Communication Foundation (20)

web programming
web programmingweb programming
web programming
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35
 
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
 
WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487
 
WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)
 
Windows communication foundation (part2) jaliya udagedara
Windows communication foundation (part2) jaliya udagedaraWindows communication foundation (part2) jaliya udagedara
Windows communication foundation (part2) jaliya udagedara
 
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
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its Security
 
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
 
Birds Of The Same Feather   Biz Talk Server And Wcf
Birds Of The Same Feather    Biz Talk Server And WcfBirds Of The Same Feather    Biz Talk Server And Wcf
Birds Of The Same Feather   Biz Talk Server And Wcf
 
complete web service1.ppt
complete web service1.pptcomplete web service1.ppt
complete web service1.ppt
 
Web programming
Web programmingWeb programming
Web programming
 
Windows communication foundation ii
Windows communication foundation iiWindows communication foundation ii
Windows communication foundation ii
 
Web services
Web servicesWeb services
Web services
 
Developing and Hosting SOAP Based Services
Developing and Hosting SOAP Based ServicesDeveloping and Hosting SOAP Based Services
Developing and Hosting SOAP Based Services
 
web services-May 25.ppt
web services-May 25.pptweb services-May 25.ppt
web services-May 25.ppt
 
Introduction to WAP
Introduction to WAPIntroduction to WAP
Introduction to WAP
 
Biztalk ESB Toolkit Introduction
Biztalk ESB Toolkit IntroductionBiztalk ESB Toolkit Introduction
Biztalk ESB Toolkit Introduction
 
RabbitMQ and AMQP with .net client library
RabbitMQ and AMQP with .net client libraryRabbitMQ and AMQP with .net client library
RabbitMQ and AMQP with .net client library
 

Último

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Último (20)

presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Windows Communication Foundation

  • 1. Windows Communication Foundation Vijay Krishna Parasi
  • 2. AGENDA • Why WCF Service & SOA Architecture • ABC’s of WCF • Hosting • MEX Endpoint • Contracts – WSDL – SOAP
  • 4. ABC’s Letter Where How What PostBox (Address) (Binding) (Contract) End Point
  • 5. Address : “the Where” – Where the network messages should be sent. HTTP: http://myserver/myservice TCP: net.tcp://myserver:8080/myservice
  • 6. Binding : “the How” – How the messages should sent. – Defines the channel used to communicate with an endpoint. – Channels will have series of binding elements. – The lowest level of binding element is Transport. – The built in transport protocols are HTTP, TCP, Named Pipes etc…
  • 7. Contract : “the What” – Defines capability of endpoint. – Defines the operations that endpoint exposes. – Also defines the message formats that the operations require. – They maps to the class methods that endpoints.
  • 8. WCF Service End Point Messages WCF Client End Point End Point Service: Can have more than one end points. Listens for messages on the address specified by the endpoint(s). Expects the messages to arrive in specified format.
  • 9. Hosting – To make service up and running. – And to make service respond to the client requests. – Hosting can be anything Console App, Web Application, IIS etc... – Hosting in IIS requires svc file.
  • 10. Metadata Exchange (MEX) Endpoint – For Service Discoverability. – Helps the clients to obtain the information of ABC’s in the form of WSDL (Web Service Description Language). – When user clicks on Add Service Reference or use svcutil.exe, MEX endpoint will be called. – Client gets WSDL  Below artifacts will be generated • Proxy class in the language of the project. • Application configuration file – To configure MEX Endpoint, • Enable the “HTTP Get” behavior. Allows the user to access MEX endpoint via browser. • Add a MEX endpoint including the other endpoints.
  • 11. WCF Service End Point Messages WCF Client End Point End Point MEX End Point MEX Endpoint: Must for a service to expose ABC’s to client.
  • 12. Calling WCF Service from Client – Can be called in two ways • Channels - Using Custom Code • Svcutil.exe Using Tools – Channels: • Interface definition is shared b/w the client & service. • Client creates a ChannelFactory class to create a channel using ABC’s. • Using the channel object client calls the service methods. – Svcutil.exe • Add Service Reference from Visual Studio. • Internally calls the svcutil.exe
  • 13. DEMO – Implementing a WCF service includes. • Implement a .NET class • Decorate the class with System.ServiceModel attributes. – System.ServiceModel namespace will be installed with.NET 3.0 – WCF Service can be implemented, • Writing entirely in Code • Writing in Code & Configuration files If we specify an address in the endpoint it overrides the base address.
  • 14. – ServiceContract • Marks a class as Contract. • Expressed in standards based on WSDL. – OperationContract • Defines methods that can be invoked on the class. • Defines the messages that are passed to and from service methods. • Operations & Messages – Within the Endpoint definition we will specify the Address, Binding & Contract.
  • 15. – When service is started by host • WCF starts the listener listens incoming requests on the configured address. • In case of IIS hosting, the listener is likely already started, WCF registers its listener with IIS. – When a message arrives, the service host • First, based on the channel stack defined by binding it applies decompression, decryption and security rules. • Second, based on the contract it deserializes the incoming message into .NET types and invokes the proper operation.
  • 16. Once again ABC’s – Each endpoint constitute ABC’s • An addressable location on the network where messages are sent. • A binding that describes how messages are sent. • A contract that describes the message formats.
  • 17. Let’s understand “Contracts” – Contract is binding agreement • B/w parties that specifies the supply of goods or services for a known price. • In WCF context, it’s an agreement between parties that specifies the message that can be exchanged based on the terms and conditions. – Description of the messages that are passed to and from service endpoints. – Endpoint must specify the operations it implement and the data formats it expect. These specifications make up the Contract.
  • 18. – Types of Contracts: • Service Contracts • Data Contracts • Message Contracts – Systems should interoperate, so we need a common platform. So WSDL is chosen. • Its an XML grammar defines the functionality offered by a service and the format of messages. • Defines what services (operations) are available in service. • It defines the methods, parameter names, parameter data types and return data types. – SOAP – Simple Object Access Protocol • Communication protocol • Format for sending messages
  • 19. .NET Types  XML XML  .NET Types .NET CLR Types WCF Service inside Host WCF Client End Points WCF Message Service Handler – How Contracts convert to CLR Types – 3 stage process • Client query the service to know ABC’s (endpoints). • This raises the metadata infrastructure on the service to generate WSDL and finally the proxy class. • Finally at runtime, when client calls the service the .NET types are serialized into XML and sends over wire.
  • 20. – Service Contracts: • They define the operations performed by service. • Two Types – ServiceContract – OperationContract • ServiceContract – Define the Interface. • OperationContract – Define the methods inside interface. • By mentioning the [ServiceContract] & [OperationContract] they will be exposed in WSDL.
  • 21. – Data Contracts: • They define which data types are passed to and from service. • WCF defines implicit contracts for built-in types such as int and string. • Can easily define explicit opt-in data contracts for custom types • Two Types – DataContract – DataMember • DataContract – Define which calls should be represent in XSD and include in WSDL. • DataMember – Define which class members should be represent in XSD and include in WSDL. • At runtime, the DataContractSerializer class serializes objects to XML using the rules defined in [DataContract] & [DataMember].
  • 22. – Message Contracts: • Allows the service to interact directly with messages. • Describe the structure of SOAP messages sent to and from a service. • Gives complete control over the SOAP message sent to and from a service by providing access to the SOAP headers and bodies directly. • They define which data types are passed to and from service. • WCF defines implicit contracts for built-in types such as int and string. • Can easily define explicit opt-in data contracts for custom types • Two Types – DataContract – DataMember • DataContract – Define which calls should be represent in XSD and include in WSDL.

Notas do Editor

  1. Missings:Message Exchange Patterns from ContractsKnownTypes – 104 Page.
  2. //Method – 1using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ServiceModel;namespace StockService{ [ServiceContract] public interface IStockService { [OperationContract] double GetPrice(string ticker); } public class StockService : IStockService { public double GetPrice(string ticker) { return 94.58; } } class Program { static void Main(string[] args) {ServiceHostserviceHost = new ServiceHost(typeof(StockService), new Uri("http://localhost:8000/StockService"));serviceHost.AddServiceEndpoint(typeof(IStockService), new BasicHttpBinding(), "");serviceHost.Open();Console.WriteLine("Press <ENTER> to terminate.\\n\\n");Console.Read();serviceHost.Close(); } }}//Method - 2using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ServiceModel;namespace StockService{ [ServiceContract] public interface IStockService { [OperationContract] double GetPrice(string ticker); } public class StockService : IStockService { public double GetPrice(string ticker) { return 94.58; } } class Program { static void Main(string[] args) {ServiceHostserviceHost = new ServiceHost(typeof(StockService));serviceHost.Open();Console.WriteLine("Press <ENTER> to terminate.\\n\\n");Console.Read();serviceHost.Close(); } }}<?xml version="1.0" encoding="utf-8" ?><configuration> <system.serviceModel> <services> <service name="StockService.StockService"behaviorConfiguration="myServiceBehaviour"> <host> <baseAddresses> <add baseAddress="http://localhost:8000/StockService"/> </baseAddresses> </host> <endpoint address="" binding="basicHttpBinding" contract="StockService.IStockService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="myServiceBehaviour"> <serviceMetadatahttpGetEnabled="True"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel></configuration>
  3. //Method – 1using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ServiceModel;namespace StockService{ [ServiceContract] public interface IStockService { [OperationContract] double GetPrice(string ticker); } public class StockService : IStockService { public double GetPrice(string ticker) { return 94.58; } } class Program { static void Main(string[] args) {ServiceHostserviceHost = new ServiceHost(typeof(StockService), new Uri("http://localhost:8000/StockService"));serviceHost.AddServiceEndpoint(typeof(IStockService), new BasicHttpBinding(), "");serviceHost.Open();Console.WriteLine("Press <ENTER> to terminate.\\n\\n");Console.Read();serviceHost.Close(); } }}//Method - 2using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ServiceModel;namespace StockService{ [ServiceContract] public interface IStockService { [OperationContract] double GetPrice(string ticker); } public class StockService : IStockService { public double GetPrice(string ticker) { return 94.58; } } class Program { static void Main(string[] args) {ServiceHostserviceHost = new ServiceHost(typeof(StockService));serviceHost.Open();Console.WriteLine("Press <ENTER> to terminate.\\n\\n");Console.Read();serviceHost.Close(); } }}<?xml version="1.0" encoding="utf-8" ?><configuration> <system.serviceModel> <services> <service name="StockService.StockService"behaviorConfiguration="myServiceBehaviour"> <host> <baseAddresses> <add baseAddress="http://localhost:8000/StockService"/> </baseAddresses> </host> <endpoint address="" binding="basicHttpBinding" contract="StockService.IStockService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="myServiceBehaviour"> <serviceMetadatahttpGetEnabled="True"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel></configuration>
  4. //Method – 1using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ServiceModel;namespace StockService{ [ServiceContract] public interface IStockService { [OperationContract] double GetPrice(string ticker); } public class StockService : IStockService { public double GetPrice(string ticker) { return 94.58; } } class Program { static void Main(string[] args) {ServiceHostserviceHost = new ServiceHost(typeof(StockService), new Uri("http://localhost:8000/StockService"));serviceHost.AddServiceEndpoint(typeof(IStockService), new BasicHttpBinding(), "");serviceHost.Open();Console.WriteLine("Press <ENTER> to terminate.\\n\\n");Console.Read();serviceHost.Close(); } }}//Method - 2using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ServiceModel;namespace StockService{ [ServiceContract] public interface IStockService { [OperationContract] double GetPrice(string ticker); } public class StockService : IStockService { public double GetPrice(string ticker) { return 94.58; } } class Program { static void Main(string[] args) {ServiceHostserviceHost = new ServiceHost(typeof(StockService));serviceHost.Open();Console.WriteLine("Press <ENTER> to terminate.\\n\\n");Console.Read();serviceHost.Close(); } }}<?xml version="1.0" encoding="utf-8" ?><configuration> <system.serviceModel> <services> <service name="StockService.StockService"behaviorConfiguration="myServiceBehaviour"> <host> <baseAddresses> <add baseAddress="http://localhost:8000/StockService"/> </baseAddresses> </host> <endpoint address="" binding="basicHttpBinding" contract="StockService.IStockService"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> </service> </services> <behaviors> <serviceBehaviors> <behavior name="myServiceBehaviour"> <serviceMetadatahttpGetEnabled="True"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel></configuration>