The latest programming framework from microsoft for distributed applications. WCF is a single answer to various approaches existed earlier which are WebServices,Remoting and COM+, DCOM etc. In other sense WCF is replacement for .Net 1.0/1.1 's Web Services and Remoting technologies.
WCF enables implimentation of SOA (Service Oriented Architecture) where application is seperated into consumable (functions/methods) services which can be consumed by client applications over a distributed environment.
WCF can use SOAP messages for communication between two processes. WCF implements many advanced web services (WS) standards such as WS-Addressing, WS-ReliableMessaging and WS-Security.
WCF implimentation
WCF Service is implimented as a class. WCF Service involves following concepts.
Service Contract
An interface that defines operations/methods that are available on the service. These methods transfer data which
Data Contract
Date Contract defines the so called data transfer objects in/out of the WCF Service.
Implimenting a WCF Service Example
http://msdn.microsoft.com/en-us/library/ms733764.aspx
WCF Service run time behaviour can be controlled. Checkout the following example.
http://msdn.microsoft.com/en-us/library/ms734715.aspx
End Points
WCF client connects to a WCF Service via an EndPoint.
End point defines (ABC) Address/Binding/Contract which specifies
- An address that indicates where the endpoint can be found.
- A binding that specifies how a client can communicate with the endpoint.
- A contract that identifies the operations available.
- A set of behaviors that specify local implementation details of the endpoint.
END POINT Example
http://msdn.microsoft.com/en-us/library/ms734786.aspx
Create Endpoint in code
http://msdn.microsoft.com/en-us/library/ms731080.aspx
Message Contracts
Data contracts carry data in and out of the operations provided by WCF. Message contracts extend or enable them over to SOAP.
WCF supports two kinds of operations.
-RPC (Remote procedure call Style) or Messaging Style
RPC uses its binary approach hence can serialise any type of data.
Messaging style is to enable SOAP with seemless programming feature for developers.
which enables developers use SOAP messages quickly and easily create and use service applications without learning SOAP protocall in much detailed.
Using Message Contracts
http://msdn.microsoft.com/en-us/library/ms734715.aspx
Hosting and Consuming WCF Services.
http://msdn.microsoft.com/en-us/library/bb332338.aspx
Now coming to consuming WCF using AJAX
I find the following example, a simple and clear demonstration of how WCF call works below the surface of new AJAX script manager reference model.
This example uses basic xmlhttprequest object to make the asynch call.
http://blogs.msdn.com/alikl/archive/2008/02/18/how-to-consume-wcf-using-ajax-without-asp-net.aspx
AJAX call to WCF service can be made using the new scriptmanagerproxy control which automatically generates a dynamic javascript object which can then be consumed in javascript.
Few Links to WCF Tools
More on this in another article soon.
Happy Coding !