SlideShare ist ein Scribd-Unternehmen logo
1 von 33
1
Introduction to WCF Services
Objectives


    Describe Windows Communication Foundation (WCF)
    and service-oriented development with WCF

    Explain the procedure to create and host a WCF service
    using Visual Studio 2008

    Explain the procedure to consume a WCF service using
    Visual Studio 2008
   Describe programmatic configuration of applications to
    host and call a WCF service

    Explain deployment of WCF services



                                         Introduction to WCF Services / Session 1   2
Introduction

   Service Oriented Architecture (SOA):
      Real World Example of SOA-based application
    
        Is an approach to create enterprise applications
       Integrates existing business components
       Exposes the application to your business partners
    
        Addresses and accommodates changes easily
    
        Helps heterogeneous platforms and applications
        communicate with each other
       Exposes the logic of an application as a service
        without letting others know about the actual code




                                       Introduction to WCF Services / Session 1   3
SOA

   In SOA:
    
        The server machine or the server program hosts the
        code
       The server machine or the server program exposes
        the code to the clients as a service
    
        Any enterprise application is built using the three
        building blocks:
         
             Code
         
             Server Program
         
             Client Program



                                       Introduction to WCF Services / Session 1    4
Windows Communication Foundation (WCF)

    WCF:
        Is an important part of the Microsoft .NET Framework architecture
        Is a SOA-based technology to create distributed enterprise applications
        Includes features like multiple protocol support, reliability, and security
        Offers interoperability with other services

    WCF key components include:
        Service Class
        WCF Runtime
        Host Application
   Service class is the actual business logic exposed as a WCF service
   WCF runtime serves any class as a WCF service
        The class should implement an interface with the ServiceContract
         attribute

    Host application hosts the WCF runtime
                                                         Introduction to WCF Services / Session 1   5
WCF Architecture 1-3

     The following figure shows the WCF architecture:





        architecture application hosts a service
          client host includes:
     The host application hosts the WCF runtimeclass through multiple
      Theserviceapplication communicates with the server application
     endpoints host application
         A service
      through the proxy class
      

         A This service class will be exposed as a WCF service
             client application


                                                         Introduction to WCF Services / Session 1   6
WCF Architecture 2-3




    Channels: the URL at which the server provides the service
    Address is
     Endpoint:
      A dispatcher component:




            Are a helper component client communicates with the service
            Specifies the following:
               Is processing units
           Is a combination of address, binding, and contract
        

    Binding describes howservice class on the server
                                        the
       
            
               Acts How componentson the server machine and takes the service request
                  Commonlyhostclientasof WCF
                   
                      as if to isreferred ABC
            Are inbuilt     it a a
                      application

    Contract on athecan beofthe server theprocess inputnext toservicemessage is
     
        Information reply specified in to the channel or output message
              Passes client and functionalitycode and configuration file
                     describes the the server to provided by the it. The
            Exist The protocol to be used for communication
               passed through a series of channels, till it reaches the client

                                                      Introduction to WCF Services / Session 1   7
WCF Architecture 3-3
   The WCF runtime exposes any class as a WCF service class
    provided:
       The class implements an interface with the
        ServiceContract attribute
    
        The WCF runtime exposes a method declared in an interface
        only with the OperationContract attribute
   The client application talks to the service application through
    the proxy class
       The client can choose to interact with the interface directly
        instead of using the proxy class
       In the figure, the proxy class:
            Forms a message on behalf of the client application
            Passes the message on to the server


                                                     Introduction to WCF Services / Session 1   8
Describing the WCF Service
   The WCF runtime:
     
         Exposes and controls a class as the WCF service
     
         Is represented in the System.ServiceModel namespace that
         resides inside the System.ServiceModel.dll library
     
         Is hosted in the host process that acts as a server application
   This server application can be:
     
         The EXE assemblies created using the console-based application,
         Windows-based application, and Windows service
     
         IIS or Windows Activation Service

    The WCF service class hosted in an application other than IIS
    is called self-hosted WCF service


                                                Introduction to WCF Services / Session 1   9
Creating and Hosting a WCF Service using Visual Studio 2008

   To create and host a WCF service in Visual Studio
    2008, you need to create a:
      
          Service interface
         Service class
         Server alias host application




                                          Introduction to WCF Services / Session 1   10
Creating a Service Interface 1-2
   The service interface describes the functionality offered
    by the server:
      Syntax

    namespace <namespace Name>
      {
        [ServiceContract]
        public interface <interface Name>
         {
            [OperationContract]
             <return type><Function Name> (Parameters …);
            [OperationContract]
             <return type><Function Name> (Parameters …);
              . .
              . .
         }
      }
                                            Introduction to WCF Services / Session 1   11
Creating a Service Interface 2-2
   The code shows a simple IHello service interface:
     Snippet
    namespace MyService
    {
        [ServiceContract]
        public interface IHello
        {
            [OperationContract]
            string SayHello(string inputMessage);
        }
    }



    In order to use the code, you need to import the
    System.ServiceModel namespace from
    System.ServiceModel.dll
                                      Introduction to WCF Services / Session 1   12
Creating a Service Class 1-2

    A service class implements the functionality declared in the service interface:
       Syntax
     namespace <namespace Name>
     {
        public class<class Name>:<interface Name>
         {
           public <return type><Function Name> (Parameters)
             {
                 // Actual functionality related code
                return <return value>;
             }
           public <return type><Function Name> (Parameters)
             {
                // Actual functionality related code
               return <return value>;
             }
         }
     }
                                                     Introduction to WCF Services / Session 1   13
Creating a Service Class 2-2

    In the code, the service class, HelloService, implements the
    IHelloService interface:

      Snippet
    namespace MyService
    {
        public class HelloService: IHello
        {
            public string SayHello(string inputMessage)
            {
                return "Hello " + inputMessage;
            }
        }
    }

   In order to use the code, you need to import the System.ServiceModel
    namespace from System.ServiceModel.dll
                                               Introduction to WCF Services / Session 1   14
Creating a Server or Host Application 1-7

    After creating the service class, you need to create a host application

    You can host the WCF service class on:
         IIS
         Custom host application

    You need to specify the Address, Binding and Contract (ABC) information
         Generally, ABC information is written in XML-based configuration files
         If the service class is IIS hosted, then the host application uses web.config
          file
      
          If the service class is self-hosted, then the host application uses app.config
          file
   The host application needs to know the following:
         Which service interface functionality should be offered to the client?
         Which protocol should be used?
         What is the information regarding input/output parameters?
      
          How to start listening requests from the client applications?
                                                            Introduction to WCF Services / Session 1   15
Creating a Server or Host Application 2-7
         <?xml version="1.0" encoding="utf-8" ?>
Syntax
    The syntax for the configuration file is as follows:
           <configuration>
            <system.serviceModel>
             <services>
               <service name="<Fully Qualified Name of the Service Class>">
                 <endpoint
                      address="<URI where the service needs to accessed>"
                      binding="<way how service needs to be accessed>"
                      contract="<Fully Qualified Name of the Interface – defines what is offered
         from the service>"/>

                       <other endpoints>

               </service>
           </services>

           <behaviors>
            <serviceBehaviors>
              <behavior>
                <serviceMetadata httpGetEnabled="true"/>
              </behavior>
            </serviceBehaviors>
           </behaviors>

          </system.serviceModel>
         </configuration>

                                                            Introduction to WCF Services / Session 1   16
Creating a Server or Host Application 3-7
Snippet                          <service name="MyService.HelloService">
          <?xml version="1.0"?>    informs the WCF runtime that the
    
          The following code showsasaa sample code class needsthe
          <configuration>
            <system.serviceModel>
                                   MyService.HelloService
                                   exposed      WCF service
                                                                   inside to be
          app.config file
             <services>
                <service name="MyService.HelloService">
         To use the code, you need to reference
                  <endpoint address="http://localhost:9898/HelloService"
                                      binding="basicHttpBinding"
          System.ServiceModel.dll     contract="MyService.IHello"/>
                </service>
                                       binding="basicHttpBinding"
                                   address=http://localhost:9898/
              </services>                informs the WCF runtime that the HTTP
                                   HelloService informs the WCF runtime
              contract="MyService.IHello" communicate and ask be used
                                    that the client will no security needs to for
                                          protocol with
                                          for communication
                 informs the WCF runtime that only the the port number 9898.
              <behaviors>           HelloService at
                <serviceBehaviors>
                 MyService.IHello kind of
                  <behavior>
                 functionality needs to be exposed from
                    <serviceMetadata httpGetEnabled="true"/>
                 the MyService.HelloService
                  </behavior>
                 class
                </serviceBehaviors>
              </behaviors>
            </system.serviceModel>
          </configuration>

                                                      Introduction to WCF Services / Session 1   17
Creating a Server or Host Application 4-7

   Consider a console application as a server
    application
    
        This means that you are hosting the WCF service on
        your own server, that is, the console application
       This refers to self-hosting
   Consider that this server listens to the client
    requests for the HelloService WCF service




                                      Introduction to WCF Services / Session 1   18
Creating a Server or Host Application 5-7
   The code shows how the server listens to the client requests

    Note that this code should be written inside the main method of
    the server
      Snippet

    ServiceHost host = new
    ServiceHost(typeof(MyService.HelloService));
    host.Open();


   In order to use the code, you need to import the
    System.ServiceModel namespace from
    System.ServiceModel.dll

    In the code, a call to Open() method creates and opens the
    listener for the service

                                           Introduction to WCF Services / Session 1   19
Creating a Server or Host Application 6-7
   In the IIS-hosted WCF service, the ServiceHost
    object used in the previous code is replaced with a file
    that has the extension .SVC

    A directive called @ServiceHost represents the
    entire code
   The syntax to use the @ServiceHost directive in
    the .SVC file is as follows:
      Syntax

    <%@ ServiceHost Language=”C#” Service=”<name of service
    class which implements functionality >" CodeBehind="<File
    which contains service class>" %>



                                       Introduction to WCF Services / Session 1   20
Creating a Server or Host Application 7-7

    The code shows a @ServiceHost directive in the HelloService.SVC
    file while you host MyService.HelloService

    To use the code, you need to add the reference to
    System.ServiceModel.dll

        Snippet


     <%@ ServiceHost Language="C#" Debug="true"
     Service="MyService.HelloService"
     CodeBehind="HelloService.svc.cs" %>




    The Service property informs the WCF runtime that when a call is given to
    the HelloService.SVC file, it should create an object of the
    MyService.HelloService class and serve it to the client

    The CodeBehind property informs the WCF runtime about the file in which
    the MyService.HelloService class is defined
                                                 Introduction to WCF Services / Session 1   21
Consuming the WCF service using Visual Studio 2008
   You can call the WCF service functionality hosted on the server
    using:
         The service interface in combination with a mediator
              
                  The mediator communicates on behalf of the client with the
                  service that is represented by a class called ChannelFactory
         The Service Reference option in Visual Studio
         The SVCUTIL.EXE utility that ships with the .NET framework

    When you use the SVCUTIL.EXE utility or the Service Reference
    option, a proxy class is created
   To share only the interface library with the client, you can use
    the ChannelFactory class



                                                  Introduction to WCF Services / Session 1   22
ChannelFactory 1-5
   To access a WCF service hosted on the server by using
    ChannelFactory:
     
         In the client application, add a reference to the service
         interface library
        Add app.config configuration file in the client
         application




                                          Introduction to WCF Services / Session 1   23
ChannelFactory 2-5
   The syntax adds the client-side app.config configuration file:
      Syntax
    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>
      <system.serviceModel>
       <client>
            <endpoint
                  address="<URI where the service needs to accessed>"
                  binding="<way how service needs to be accessed>"

                   contract="<Fully Qualified Name of the Interface –
    defines what
                              is offered from the service>"
                   name="<Name_For_the_Configuration>"/>

       </client>
      </system.serviceModel>
    </configuration>
                                              Introduction to WCF Services / Session 1   24
ChannelFactory 3-5
   The code shows the code in the app.config configuration file for
    the HelloService WCF service:
     Snippet
    <?xml version="1.0"?>
    <configuration>
      <system.serviceModel>
        <client>
                 <endpoint
    address="http://localhost:9898/HelloService"
                       binding="basicHttpBinding"
                       contract="MyService.IHello"
                       name="MyEndPoint"/>
        </client>
       </system.serviceModel>
    </configuration>

                                          Introduction to WCF Services / Session 1   25
ChannelFactory 4-5
   The syntax to use the service interface and create an object is as
    follows:

      Syntax


    <Interfacereference>= new ChannelFactory<Interface
    Type>("<Name_For_the_Configuration>").CreateChannel();




                                             Introduction to WCF Services / Session 1   26
ChannelFactory 5-5
   The code shows how to use ChannelFactory to call the
    HelloService WCF service

    You need to import the System.ServiceModel namespace
    from System.ServiceModel.dll

     Snippet

    IHello obj = new ChannelFactory<IHello>("
    MyEndPoint").CreateChannel();
    Console.WriteLine(obj.SayHello("WCF"));




    Call the CreateChannel() method



                                      Introduction to WCF Services / Session 1   27
The Service Reference Option

    To access the WCF service hosted on the server by
    using the Service Reference option in Visual Studio,
    follow these steps:
     1. Ensure that the server application is running
     2. In the client application, in the Solution Explorer window, right-
        click References and click Add Service Reference. The Add
        Service Reference window is displayed
     3. To call the service, in the Address text box, type the URL
     4. To hold the proxy class, in the Namespace textbox, type the
        namespace name
     5. To add the proxy, click OK
     6. Create a proxy class object and call the Web method




                                               Introduction to WCF Services / Session 1   28
Using the SVCUTIL.EXE Utility 1-2
   To create a proxy class and access the WCF service
    using the SVCUTIL.EXE utility, perform the following
    steps:
     1. Ensure the server application is running
     2. Click Start Programs Microsoft Visual Studio 2008 Visual
        Studio Tools Visual Studio 2008 Command Prompt
     3. Use the following syntax to use the SVCUTIL.EXE utility
          Syntax
        SVCUTIL /Config:App.Config /Out:<Proxy Class File Name>
        “<type the URL with which the service can be called >”

        The code shows how to use the SVCUTIL command to
        generate the proxy class and the configuration file for
        HelloService WCF service
         Snippet
       SVCUTIL /Config:App.Config /Out:proxy.cs
       “http://localhost:9898/HelloService”

                                             Introduction to WCF Services / Session 1   29
Using the SVCUTIL.EXE Utility 2-2


4. Press Enter. This generates two files, the proxy class file and the
   app.config configuration file
5. Add the generated files, the proxy class file and the app.config file
   to the client application
6. Call the WCF service using the proxy class object (generated in Step
   4)




                                           Introduction to WCF Services / Session 1   30
Deploying a WCF Service 1-2

    The following figure displays different types of host applications
    host a WCF service:            IIS 6.0 only supports HTTP protocol
                                    IIS 7.0 supports TCP and HTTP
                                     protocols
                                 
                                     The service hosted using the following
                                     is called the self-hosted WCF service:
                                         Windows application
                                         Console application
                                         Windows service




                                             Introduction to WCF Services / Session 1   31
Deploying a WCF Service 2-2

    The table shows various hosting environments and the
    protocols that each environment supports:

        Hosting Environment               Supported Protocols
Windows or Console application      HTTP, net.tcp, net.pipe,
                                    net.msmq
Windows service application         HTTP, net.tcp, net.pipe,
                                    net.msmq
Web Server IIS6                     HTTP
Web Server IIS7 - Windows Process   HTTP, net.tcp, net.pipe,
Activation Service (WAS)            net.msmq




                                       Introduction to WCF Services / Session 1   32
Summary

    WCF is a SOA-based technology from Microsoft for distributed enterprise
    application development

    A WCF service class implements an interface with the
    [ServiceContract] attribute and exposes the methods with the
    [OperationContract] attribute

    The server application hosts a WCF service class and offers the functionality
    of the class as a service to the clients

    WCF services can be self-hosted or IIS hosted

    A client determines the functionality offered by the server using the interface
    or the proxy class

    A client requests the functionality from a WCF service using the
    ChannelFactory class, the proxy class, or the SVCUTIL.EXE utility
   The client and server configuration can be written either in code or in
    configuration files



                                                     Introduction to WCF Services / Session 1   33

Weitere ähnliche Inhalte

Was ist angesagt?

Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceSj Lim
 
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.0Saltmarch 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
 
10 Tricks and Tips for WCF
10 Tricks and Tips for WCF10 Tricks and Tips for WCF
10 Tricks and Tips for WCFBarry Dorrans
 
WebService-Java
WebService-JavaWebService-Java
WebService-Javahalwal
 
IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction ejlp12
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overviewArbind Tiwari
 
Introduction to WebSphere Message Broker
Introduction to WebSphere Message BrokerIntroduction to WebSphere Message Broker
Introduction to WebSphere Message BrokerAnt Phillips
 
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
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Subodh Pushpak
 
Dot Net Training Dot Net35
Dot Net Training Dot Net35Dot Net Training Dot Net35
Dot Net Training Dot Net35Subodh Pushpak
 
Beginning with wcf service
Beginning with wcf serviceBeginning with wcf service
Beginning with wcf serviceBinu Bhasuran
 
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
Web servicesWeb services
Web servicesaspnet123
 

Was ist angesagt? (20)

Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) Service
 
WCF for begineers
WCF  for begineersWCF  for begineers
WCF for begineers
 
WCF
WCFWCF
WCF
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
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
 
10 Tricks and Tips for WCF
10 Tricks and Tips for WCF10 Tricks and Tips for WCF
10 Tricks and Tips for WCF
 
WebService-Java
WebService-JavaWebService-Java
WebService-Java
 
WCF Introduction
WCF IntroductionWCF Introduction
WCF Introduction
 
IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction IBM WebSphere MQ Introduction
IBM WebSphere MQ Introduction
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overview
 
Wcf development
Wcf developmentWcf development
Wcf development
 
Introduction to WebSphere Message Broker
Introduction to WebSphere Message BrokerIntroduction to WebSphere Message Broker
Introduction to WebSphere Message Broker
 
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
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35
 
Dot Net Training Dot Net35
Dot Net Training Dot Net35Dot Net Training Dot Net35
Dot Net Training Dot Net35
 
Silverlight Training
Silverlight TrainingSilverlight Training
Silverlight Training
 
Beginning with wcf service
Beginning with wcf serviceBeginning with wcf service
Beginning with wcf service
 
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
Web servicesWeb services
Web services
 

Ähnlich wie WFC #1

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 programming
Web programmingWeb programming
Web programmingsowfi
 
The Future Of Work And Workflow
The Future Of Work And WorkflowThe Future Of Work And Workflow
The Future Of Work And WorkflowBrandon Satrom
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questionstongdang
 
Wcf hosting and endpoints
Wcf hosting and endpointsWcf hosting and endpoints
Wcf hosting and endpointsdilipkumardubey
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Storyukdpe
 
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
 
Enterprise Software Architecture
Enterprise Software ArchitectureEnterprise Software Architecture
Enterprise Software Architecturerahmed_sct
 
Application integration framework & Adaptor ppt
Application integration framework & Adaptor pptApplication integration framework & Adaptor ppt
Application integration framework & Adaptor pptAditya Negi
 
WINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATIONWINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATIONDeepika Chaudhary
 
Unit 3-SOA Technologies
Unit 3-SOA TechnologiesUnit 3-SOA Technologies
Unit 3-SOA Technologiesssuser3a47cb
 
Web services in java
Web services in javaWeb services in java
Web services in javamaabujji
 

Ähnlich wie WFC #1 (20)

WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)
 
SOA & WCF
SOA & WCFSOA & WCF
SOA & WCF
 
Wcf
Wcf Wcf
Wcf
 
WCF
WCFWCF
WCF
 
Web Service Security
Web Service SecurityWeb Service Security
Web Service Security
 
Web programming
Web programmingWeb programming
Web programming
 
The Future Of Work And Workflow
The Future Of Work And WorkflowThe Future Of Work And Workflow
The Future Of Work And Workflow
 
Top wcf interview questions
Top wcf interview questionsTop wcf interview questions
Top wcf interview questions
 
15376199.ppt
15376199.ppt15376199.ppt
15376199.ppt
 
Wcf hosting and endpoints
Wcf hosting and endpointsWcf hosting and endpoints
Wcf hosting and endpoints
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Story
 
App fabric overview
App fabric overviewApp fabric overview
App fabric overview
 
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
 
Unit 5
Unit 5Unit 5
Unit 5
 
Enterprise Software Architecture
Enterprise Software ArchitectureEnterprise Software Architecture
Enterprise Software Architecture
 
Application integration framework & Adaptor ppt
Application integration framework & Adaptor pptApplication integration framework & Adaptor ppt
Application integration framework & Adaptor ppt
 
WINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATIONWINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATION
 
Unit 3-SOA Technologies
Unit 3-SOA TechnologiesUnit 3-SOA Technologies
Unit 3-SOA Technologies
 
Web services in java
Web services in javaWeb services in java
Web services in java
 

Kürzlich hochgeladen

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
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)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
+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...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
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
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

WFC #1

  • 2. Objectives  Describe Windows Communication Foundation (WCF) and service-oriented development with WCF  Explain the procedure to create and host a WCF service using Visual Studio 2008  Explain the procedure to consume a WCF service using Visual Studio 2008  Describe programmatic configuration of applications to host and call a WCF service  Explain deployment of WCF services Introduction to WCF Services / Session 1 2
  • 3. Introduction  Service Oriented Architecture (SOA): Real World Example of SOA-based application  Is an approach to create enterprise applications  Integrates existing business components  Exposes the application to your business partners  Addresses and accommodates changes easily  Helps heterogeneous platforms and applications communicate with each other  Exposes the logic of an application as a service without letting others know about the actual code Introduction to WCF Services / Session 1 3
  • 4. SOA  In SOA:  The server machine or the server program hosts the code  The server machine or the server program exposes the code to the clients as a service  Any enterprise application is built using the three building blocks:  Code  Server Program  Client Program Introduction to WCF Services / Session 1 4
  • 5. Windows Communication Foundation (WCF)  WCF:  Is an important part of the Microsoft .NET Framework architecture  Is a SOA-based technology to create distributed enterprise applications  Includes features like multiple protocol support, reliability, and security  Offers interoperability with other services  WCF key components include:  Service Class  WCF Runtime  Host Application  Service class is the actual business logic exposed as a WCF service  WCF runtime serves any class as a WCF service  The class should implement an interface with the ServiceContract attribute  Host application hosts the WCF runtime Introduction to WCF Services / Session 1 5
  • 6. WCF Architecture 1-3  The following figure shows the WCF architecture:   architecture application hosts a service client host includes: The host application hosts the WCF runtimeclass through multiple Theserviceapplication communicates with the server application endpoints host application A service through the proxy class   A This service class will be exposed as a WCF service client application Introduction to WCF Services / Session 1 6
  • 7. WCF Architecture 2-3 Channels: the URL at which the server provides the service Address is Endpoint: A dispatcher component:   Are a helper component client communicates with the service Specifies the following: Is processing units Is a combination of address, binding, and contract     Binding describes howservice class on the server the    Acts How componentson the server machine and takes the service request Commonlyhostclientasof WCF  as if to isreferred ABC Are inbuilt it a a application  Contract on athecan beofthe server theprocess inputnext toservicemessage is   Information reply specified in to the channel or output message  Passes client and functionalitycode and configuration file describes the the server to provided by the it. The Exist The protocol to be used for communication passed through a series of channels, till it reaches the client Introduction to WCF Services / Session 1 7
  • 8. WCF Architecture 3-3  The WCF runtime exposes any class as a WCF service class provided:  The class implements an interface with the ServiceContract attribute  The WCF runtime exposes a method declared in an interface only with the OperationContract attribute  The client application talks to the service application through the proxy class  The client can choose to interact with the interface directly instead of using the proxy class  In the figure, the proxy class:  Forms a message on behalf of the client application  Passes the message on to the server Introduction to WCF Services / Session 1 8
  • 9. Describing the WCF Service  The WCF runtime:  Exposes and controls a class as the WCF service  Is represented in the System.ServiceModel namespace that resides inside the System.ServiceModel.dll library  Is hosted in the host process that acts as a server application  This server application can be:  The EXE assemblies created using the console-based application, Windows-based application, and Windows service  IIS or Windows Activation Service  The WCF service class hosted in an application other than IIS is called self-hosted WCF service Introduction to WCF Services / Session 1 9
  • 10. Creating and Hosting a WCF Service using Visual Studio 2008  To create and host a WCF service in Visual Studio 2008, you need to create a:  Service interface  Service class  Server alias host application Introduction to WCF Services / Session 1 10
  • 11. Creating a Service Interface 1-2  The service interface describes the functionality offered by the server: Syntax namespace <namespace Name> { [ServiceContract] public interface <interface Name> { [OperationContract] <return type><Function Name> (Parameters …); [OperationContract] <return type><Function Name> (Parameters …); . . . . } } Introduction to WCF Services / Session 1 11
  • 12. Creating a Service Interface 2-2  The code shows a simple IHello service interface: Snippet namespace MyService { [ServiceContract] public interface IHello { [OperationContract] string SayHello(string inputMessage); } }  In order to use the code, you need to import the System.ServiceModel namespace from System.ServiceModel.dll Introduction to WCF Services / Session 1 12
  • 13. Creating a Service Class 1-2  A service class implements the functionality declared in the service interface: Syntax namespace <namespace Name> { public class<class Name>:<interface Name> { public <return type><Function Name> (Parameters) { // Actual functionality related code return <return value>; } public <return type><Function Name> (Parameters) { // Actual functionality related code return <return value>; } } } Introduction to WCF Services / Session 1 13
  • 14. Creating a Service Class 2-2  In the code, the service class, HelloService, implements the IHelloService interface: Snippet namespace MyService { public class HelloService: IHello { public string SayHello(string inputMessage) { return "Hello " + inputMessage; } } }  In order to use the code, you need to import the System.ServiceModel namespace from System.ServiceModel.dll Introduction to WCF Services / Session 1 14
  • 15. Creating a Server or Host Application 1-7  After creating the service class, you need to create a host application  You can host the WCF service class on:  IIS  Custom host application  You need to specify the Address, Binding and Contract (ABC) information  Generally, ABC information is written in XML-based configuration files  If the service class is IIS hosted, then the host application uses web.config file  If the service class is self-hosted, then the host application uses app.config file  The host application needs to know the following:  Which service interface functionality should be offered to the client?  Which protocol should be used?  What is the information regarding input/output parameters?  How to start listening requests from the client applications? Introduction to WCF Services / Session 1 15
  • 16. Creating a Server or Host Application 2-7 <?xml version="1.0" encoding="utf-8" ?> Syntax  The syntax for the configuration file is as follows: <configuration> <system.serviceModel> <services> <service name="<Fully Qualified Name of the Service Class>"> <endpoint address="<URI where the service needs to accessed>" binding="<way how service needs to be accessed>" contract="<Fully Qualified Name of the Interface – defines what is offered from the service>"/> <other endpoints> </service> </services> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration> Introduction to WCF Services / Session 1 16
  • 17. Creating a Server or Host Application 3-7 Snippet <service name="MyService.HelloService"> <?xml version="1.0"?> informs the WCF runtime that the  The following code showsasaa sample code class needsthe <configuration> <system.serviceModel> MyService.HelloService exposed WCF service inside to be app.config file <services> <service name="MyService.HelloService">  To use the code, you need to reference <endpoint address="http://localhost:9898/HelloService" binding="basicHttpBinding" System.ServiceModel.dll contract="MyService.IHello"/> </service> binding="basicHttpBinding" address=http://localhost:9898/ </services> informs the WCF runtime that the HTTP HelloService informs the WCF runtime contract="MyService.IHello" communicate and ask be used that the client will no security needs to for protocol with for communication informs the WCF runtime that only the the port number 9898. <behaviors> HelloService at <serviceBehaviors> MyService.IHello kind of <behavior> functionality needs to be exposed from <serviceMetadata httpGetEnabled="true"/> the MyService.HelloService </behavior> class </serviceBehaviors> </behaviors> </system.serviceModel> </configuration> Introduction to WCF Services / Session 1 17
  • 18. Creating a Server or Host Application 4-7  Consider a console application as a server application  This means that you are hosting the WCF service on your own server, that is, the console application  This refers to self-hosting  Consider that this server listens to the client requests for the HelloService WCF service Introduction to WCF Services / Session 1 18
  • 19. Creating a Server or Host Application 5-7  The code shows how the server listens to the client requests  Note that this code should be written inside the main method of the server Snippet ServiceHost host = new ServiceHost(typeof(MyService.HelloService)); host.Open();  In order to use the code, you need to import the System.ServiceModel namespace from System.ServiceModel.dll  In the code, a call to Open() method creates and opens the listener for the service Introduction to WCF Services / Session 1 19
  • 20. Creating a Server or Host Application 6-7  In the IIS-hosted WCF service, the ServiceHost object used in the previous code is replaced with a file that has the extension .SVC  A directive called @ServiceHost represents the entire code  The syntax to use the @ServiceHost directive in the .SVC file is as follows: Syntax <%@ ServiceHost Language=”C#” Service=”<name of service class which implements functionality >" CodeBehind="<File which contains service class>" %> Introduction to WCF Services / Session 1 20
  • 21. Creating a Server or Host Application 7-7  The code shows a @ServiceHost directive in the HelloService.SVC file while you host MyService.HelloService  To use the code, you need to add the reference to System.ServiceModel.dll Snippet <%@ ServiceHost Language="C#" Debug="true" Service="MyService.HelloService" CodeBehind="HelloService.svc.cs" %>  The Service property informs the WCF runtime that when a call is given to the HelloService.SVC file, it should create an object of the MyService.HelloService class and serve it to the client  The CodeBehind property informs the WCF runtime about the file in which the MyService.HelloService class is defined Introduction to WCF Services / Session 1 21
  • 22. Consuming the WCF service using Visual Studio 2008  You can call the WCF service functionality hosted on the server using:  The service interface in combination with a mediator  The mediator communicates on behalf of the client with the service that is represented by a class called ChannelFactory  The Service Reference option in Visual Studio  The SVCUTIL.EXE utility that ships with the .NET framework  When you use the SVCUTIL.EXE utility or the Service Reference option, a proxy class is created  To share only the interface library with the client, you can use the ChannelFactory class Introduction to WCF Services / Session 1 22
  • 23. ChannelFactory 1-5  To access a WCF service hosted on the server by using ChannelFactory:  In the client application, add a reference to the service interface library  Add app.config configuration file in the client application Introduction to WCF Services / Session 1 23
  • 24. ChannelFactory 2-5  The syntax adds the client-side app.config configuration file: Syntax <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <client> <endpoint address="<URI where the service needs to accessed>" binding="<way how service needs to be accessed>" contract="<Fully Qualified Name of the Interface – defines what is offered from the service>" name="<Name_For_the_Configuration>"/> </client> </system.serviceModel> </configuration> Introduction to WCF Services / Session 1 24
  • 25. ChannelFactory 3-5  The code shows the code in the app.config configuration file for the HelloService WCF service: Snippet <?xml version="1.0"?> <configuration> <system.serviceModel> <client> <endpoint address="http://localhost:9898/HelloService" binding="basicHttpBinding" contract="MyService.IHello" name="MyEndPoint"/> </client> </system.serviceModel> </configuration> Introduction to WCF Services / Session 1 25
  • 26. ChannelFactory 4-5  The syntax to use the service interface and create an object is as follows: Syntax <Interfacereference>= new ChannelFactory<Interface Type>("<Name_For_the_Configuration>").CreateChannel(); Introduction to WCF Services / Session 1 26
  • 27. ChannelFactory 5-5  The code shows how to use ChannelFactory to call the HelloService WCF service  You need to import the System.ServiceModel namespace from System.ServiceModel.dll Snippet IHello obj = new ChannelFactory<IHello>(" MyEndPoint").CreateChannel(); Console.WriteLine(obj.SayHello("WCF"));  Call the CreateChannel() method Introduction to WCF Services / Session 1 27
  • 28. The Service Reference Option  To access the WCF service hosted on the server by using the Service Reference option in Visual Studio, follow these steps: 1. Ensure that the server application is running 2. In the client application, in the Solution Explorer window, right- click References and click Add Service Reference. The Add Service Reference window is displayed 3. To call the service, in the Address text box, type the URL 4. To hold the proxy class, in the Namespace textbox, type the namespace name 5. To add the proxy, click OK 6. Create a proxy class object and call the Web method Introduction to WCF Services / Session 1 28
  • 29. Using the SVCUTIL.EXE Utility 1-2  To create a proxy class and access the WCF service using the SVCUTIL.EXE utility, perform the following steps: 1. Ensure the server application is running 2. Click Start Programs Microsoft Visual Studio 2008 Visual Studio Tools Visual Studio 2008 Command Prompt 3. Use the following syntax to use the SVCUTIL.EXE utility Syntax SVCUTIL /Config:App.Config /Out:<Proxy Class File Name> “<type the URL with which the service can be called >” The code shows how to use the SVCUTIL command to generate the proxy class and the configuration file for HelloService WCF service Snippet SVCUTIL /Config:App.Config /Out:proxy.cs “http://localhost:9898/HelloService” Introduction to WCF Services / Session 1 29
  • 30. Using the SVCUTIL.EXE Utility 2-2 4. Press Enter. This generates two files, the proxy class file and the app.config configuration file 5. Add the generated files, the proxy class file and the app.config file to the client application 6. Call the WCF service using the proxy class object (generated in Step 4) Introduction to WCF Services / Session 1 30
  • 31. Deploying a WCF Service 1-2  The following figure displays different types of host applications host a WCF service:  IIS 6.0 only supports HTTP protocol  IIS 7.0 supports TCP and HTTP protocols  The service hosted using the following is called the self-hosted WCF service:  Windows application  Console application  Windows service Introduction to WCF Services / Session 1 31
  • 32. Deploying a WCF Service 2-2  The table shows various hosting environments and the protocols that each environment supports: Hosting Environment Supported Protocols Windows or Console application HTTP, net.tcp, net.pipe, net.msmq Windows service application HTTP, net.tcp, net.pipe, net.msmq Web Server IIS6 HTTP Web Server IIS7 - Windows Process HTTP, net.tcp, net.pipe, Activation Service (WAS) net.msmq Introduction to WCF Services / Session 1 32
  • 33. Summary  WCF is a SOA-based technology from Microsoft for distributed enterprise application development  A WCF service class implements an interface with the [ServiceContract] attribute and exposes the methods with the [OperationContract] attribute  The server application hosts a WCF service class and offers the functionality of the class as a service to the clients  WCF services can be self-hosted or IIS hosted  A client determines the functionality offered by the server using the interface or the proxy class  A client requests the functionality from a WCF service using the ChannelFactory class, the proxy class, or the SVCUTIL.EXE utility  The client and server configuration can be written either in code or in configuration files Introduction to WCF Services / Session 1 33