WCF Concepts


WCF is based on the concept of messages. A message contains some sort of communication between a client and a service. Note that the program doesn’t need to deal directly with messages. It can issue subroutine and function calls just as if it were calling a local object’s methods. The WCF library routines convert the call into a message and send it to the recipient transparently.

An endpoint is a place where messages are sent or received. Typically, a service creates endpoints to receive request messages from clients and clients create endpoints to initiate those requests.

Endpoints define the characteristics of the communication. They determine the number and types of parameters passed to a request and the type of any returned data. They determine whether the communication uses a request-reply, one-way, or duplex style of communication. The definition of the message format is called its service contract.

The message definitions at the endpoints at the two ends of a communication must agree. They must satisfy the same service contract. If a client sends a message in one format, but the service expects the message in a different format, the communication won’t work. WCF provides tools that help you define service endpoints and automatically generate Visual Basic code to properly use corresponding client endpoints.

After you have built the client and server, the two pass messages between their endpoints following the rules of the service contract. For example, if the contract indicates that the communication is one-way, the client invokes service subroutines that do not return any data. If the communication has a request-reply style, the client invokes service functions that return some sort of reply. If the contract indicates duplex communication, then the client can call service subroutines and the server can invoke client call-backs. For example, the client can tell the service that it is interested in certain events such as stock price updates, and then the service can call the client as the updates are available.

The following sections describe a concrete example that implements a simple client and server.




Visual Basic 2005 with  .NET 3.0 Programmer's Reference
Visual Basic 2005 with .NET 3.0 Programmer's Reference
ISBN: 470137053
EAN: N/A
Year: 2007
Pages: 417

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net