Sunday 18 May 2014

What is End piont in WCF with Example.

 End point: 
1. Where is Address-->http/local host
2. How to Binding -->how u communicate-->protocol
3. What is Contract--> it tell to client what i am?
WCF Service is a program that displays a set of evaluation criteria. Each endpoint is the gateway to communicate with the world.
All communication is through the WCF is endpoint. Endpoint consists of three elements.


Address :-Basically URL, which determines the service is hosted WCF. Customers will use this link to connect to the service.  
For example
http://localhost:8090/MyService/SimpleCalculator.svc 

Binding :-Describes how binding the client will communicate with the service. There are different protocols available for the client to connect to the WCF. It can remind you type protocol based on your needs.
Link has many features, including the following:

  •   Transport -Defines the base protocol to be used like HTTP, Named Pipes, TCP, and MSMQ are some type of protocols.  
  •  Encoding (Optional) - Three types of encoding are available-Text, Binary, or Message Transmission Optimization Mechanism (MTOM). MTOM is an interoperable message format that allows the effective transmission of attachments or large messages (greater than 64K). 
  •    Protocol(Optional) - Defines information to be used in the binding such as Security, transaction or reliable messaging capability
 The following table gives some list of protocols supported by WCF binding.


Binding
Description
BasicHttpBinding
Basic Web service communication. No security by default
WSHttpBinding
Web services with WS-* support. Supports transactions
WSDualHttpBinding
Web services with duplex contract and transaction support
WSFederationHttpBinding
Web services with federated security. Supports transactions
MsmqIntegrationBinding
Communication directly with MSMQ applications. Supports transactions
NetMsmqBinding
Communication between WCF applications by using queuing. Supports transactions
NetNamedPipeBinding
Communication between WCF applications on same computer. Supports duplex contracts and transactions
NetPeerTcpBinding
Communication between computers across peer-to-peer services. Supports duplex contracts
NetTcpBinding
Communication between WCF applications across computers. Supports duplex contracts and transactions
 Contract:-Collection process determines endpoint connection with the outside world. Typically, the name of the interface in the contract, so the client is aware of the operations are exposed to the client. Each transaction is a simple form of exchange, as a way, duplex and request / response.
Below illustrate the endpoint Features




Example:
Eventually will be mentioned in the web.config file on the service that has been created.



<system.serviceModel>
<services>
      <service name="MathService"
        behaviorConfiguration="MathServiceBehavior">
       <endpoint
         address="http://localhost:8090/MyService/MathService.svc" contract="IMathService"
          binding="wsHttpBinding"/> 
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MathServiceBehavior">
          <serviceMetadata httpGetEnabled="True"/>
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

0 comments:

Post a Comment