Tuesday, September 28, 2010

ABC's OF WCF

  1. Address [the where]
    Defines where on the network messages should be sent so that the endpoint receives them.
    This is the location to which messages must be sent by the client.
    For HTTP, the address http://myserver/myservice/
    For TCP, the address net.tcp://myserver:8080/myservice
    Address is where you communicate. This is not the same as the location you deploy your service, but the URL that will be used internally to map your requests and responses.
  2. Binding [The How]
    Defines the channel used to communicate with an endpoint.
    Channels are the conduit through which all messages pass within a WCF application.
    A channel is composed of a series of binding elements.
    The lowest level binding element is the transport.
    The built-in transports include HTTP, TCP, Named Pipes, PerChannel, and MSMQ. Above this are binding elements that specify security and transactions.
    Fortunately, WCF ships with system-provided bindings that have the channels stacked and configured correctly to save you the time of figuring it out yourself.
    Which delivers messages over the network.
    Binding is how you communicate. There are several default ones like BasicHttp, TCP, NamedPipes, MSMQ and several others. This is the protocol that the server and client understands while communicating.

  3. Contract [The What]
    Defines the capability or feature set offered by the endpoint.
    Defines the operations that an endpoint exposes and the message formats that the operations require.
    Contract operations map to class methods that implement the endpoint, including the signature of parameters passed in and out of the methods.
    Contract is what you communicate.
  4. There are two types of contracts:
    Service Contracts:
    It is the API the service consumer invokes on your service. It's the method signature that will go into the WSDL.
    Data Contracts:
    It is your data that would travel from the service consumer and the service.
    It's the data structure.
    This can be found in the schema of your service.
    There is something else called Message Contract, which is basically a way to communicate using messages instead of strictly typed structures. There are several situations where you want to use this, but is out of the context for this Session.

No comments:

Post a Comment