<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>SOA</title>
        <link>http://geekswithblogs.net/rajeshpillai/category/11103.aspx</link>
        <description>Service Oriented Architecture</description>
        <language>en-US</language>
        <copyright>Rajesh Pillai</copyright>
        <managingEditor>thinkrajesh@yahoo.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>WCF 2 - Building Blocks</title>
            <link>http://geekswithblogs.net/rajeshpillai/archive/2009/12/20/wcf_2_building_blocks.aspx</link>
            <description>&lt;h2&gt;Building Blocks of Service&lt;/h2&gt;
&lt;p&gt;Service is a&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Collection of operations that are exposed to the clients.&lt;/li&gt;
    &lt;li&gt;Service contract defines what operations are available and how clients use them.&lt;/li&gt;
    &lt;li&gt;Data contract describes data that the client and service can exchange.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Service Contracts&lt;/h2&gt;
&lt;p&gt;Service Contracts&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Describe the operations supported by a service, the message exhange pattern used and format of each&lt;br /&gt;
    message.&lt;/li&gt;
    &lt;li&gt;ServiceContract attribute marks an interface as a service contract.&lt;/li&gt;
    &lt;li&gt;OperationContract attribute exposes methods of the interface.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;&lt;u&gt;Code snippet&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;
[ServiceContract]
public interface IHelloService 
{
     [OperationContract]
     string SayHello (string yourName);
}&lt;/pre&gt;
&lt;h2&gt;Data Contracts&lt;/h2&gt;
&lt;p&gt;A data contracts&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Describes how CLR types are mapped to XSD schema definitions.&lt;/li&gt;
    &lt;li&gt;Enable complex types to be serialized and deserialized so it can be passed across.&lt;/li&gt;
    &lt;li&gt;DataContract attribute identiifes each class that can be serialized.&lt;/li&gt;
    &lt;li&gt;DataMember attribute identifies members that needs to be exposed to the clients.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;&lt;u&gt;Code snippet&lt;/u&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Here's an example of a data contract for a account class.&lt;/p&gt;
&lt;pre&gt;
[DataContract]

public class Account

{

    [DataMember]

    public sting AccountNo { get; set; }
&lt;div&gt;    [DataMember]&lt;br /&gt;&lt;br /&gt;    public sting AccountType { get; set; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt; &lt;/div&gt;&lt;/pre&gt;
&lt;div&gt;The DataContract is applied at the class level and the DataMember is applied at the individual member level.  &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;h2&gt;Endpoints&lt;/h2&gt;
&lt;p&gt;The client communicates with service  via endpoints.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Host application makes the service available by providing one or more endpoints to the clients.&lt;/li&gt;
    &lt;li&gt;Endpoint consist of&lt;br /&gt;
    - Address of service (Where?)&lt;br /&gt;
    - Binding (How?)&lt;br /&gt;
    - Contract (What?)&lt;/li&gt;
    &lt;li&gt;Client and Service use the same endpoint.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Address-Binding-Contract are the ABC's of service. &lt;/p&gt;
&lt;h2&gt;Bindings&lt;/h2&gt;
&lt;ul&gt;
    &lt;li&gt;Specify how a service endpoint communicates with client endpoints.&lt;/li&gt;
    &lt;li&gt;Consist of binding elements describing some essential aspect of communication like&lt;br /&gt;
    - Transport (HTTP, TCP, etc)&lt;br /&gt;
    - Protocol (security, reliability, transctions, sessions etc)&lt;br /&gt;
    - Messge encoding (text, binary etc)&lt;/li&gt;
    &lt;li&gt;Can be declared programatically or declaratively in the config file.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Out of box Bindings&lt;/h2&gt;
&lt;ul&gt;
    &lt;li&gt;BasicHttpBinding&lt;br /&gt;
    Compatible with ASMX Web Services.&lt;/li&gt;
    &lt;li&gt;WSHttpBinding&lt;br /&gt;
    - Conforms to WS* specifications for reliability, security and transactions.&lt;br /&gt;
    - Default&lt;/li&gt;
    &lt;li&gt;WS2007HttpBinding&lt;br /&gt;
    - Conforms to OASIS specifications for reliability, security and transactions.&lt;/li&gt;
    &lt;li&gt;WSDualHttpBinding&lt;br /&gt;
    - Supports WS-* + two-way communication&lt;/li&gt;
    &lt;li&gt;WSFederationBinding&lt;br /&gt;
    - Supports the WS-Federation specification for sharing identities across multiple systems.&lt;/li&gt;
    &lt;li&gt;WS2007FederationBinding&lt;br /&gt;
    - Supports federated security.&lt;/li&gt;
    &lt;li&gt;NetTcpBinding&lt;br /&gt;
    - Communicates across processes and machines.&lt;/li&gt;
    &lt;li&gt;NetNamedPipeBinding&lt;br /&gt;
    - Communicates on same machine&lt;/li&gt;
    &lt;li&gt;NetPeerBinding&lt;br /&gt;
    - Peer to peer communications over TCP&lt;/li&gt;
    &lt;li&gt;NetMsmqBinding&lt;br /&gt;
    - Uses MSMQ to transmit messages&lt;/li&gt;
    &lt;li&gt;MsmqIntegrationBinding&lt;br /&gt;
    - Service can send or receive messages from a MSMQ queue.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The most frequently used binding is the BasicHttpBinding, the WSHttpBinding and the NetTcpBinding.&lt;/p&gt;
&lt;p&gt;That's it for now!!!&lt;/p&gt; &lt;img src="http://geekswithblogs.net/rajeshpillai/aggbug/137140.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rajesh Pillai</dc:creator>
            <guid>http://geekswithblogs.net/rajeshpillai/archive/2009/12/20/wcf_2_building_blocks.aspx</guid>
            <pubDate>Sun, 20 Dec 2009 15:44:13 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/rajeshpillai/comments/137140.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/rajeshpillai/archive/2009/12/20/wcf_2_building_blocks.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/rajeshpillai/comments/commentRss/137140.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/rajeshpillai/services/trackbacks/137140.aspx</trackback:ping>
        </item>
        <item>
            <title>WCF 1 - Introduction</title>
            <link>http://geekswithblogs.net/rajeshpillai/archive/2009/12/20/wcf_1.aspx</link>
            <description>&lt;h2&gt;What is WCF?&lt;/h2&gt;
&lt;p&gt;Windows Communication Foundation aka WCF is a Microsoft platform for SOA &lt;br /&gt;
(Service Oriented Architecture).  The following are some of the important aspects that WCF allows us to achieve.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Its used for building distributed and interoperatble applications.&lt;/li&gt;
    &lt;li&gt;Unifies ASMX, .NET Remoting, Enterprise Services, MSMQ etc.&lt;/li&gt;
    &lt;li&gt;A single programming model for all distributed computing technology.&lt;/li&gt;
    &lt;li&gt;Configuration driven protocol choices, messaging format, reliable transactions etc.&lt;/li&gt;
    &lt;li&gt;Built for service-oriented system design&lt;/li&gt;
    &lt;li&gt;Loosely coupled.  Not bound to a particular protocol, encoding format or hosting environmnet.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Its built on top of .NET and is available with .net framework 3.0 and 3.5.  The overall WCF structure revolves around the following three core contracts.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;Service Contract&lt;/strong&gt;     Defines which operations on the service can be invoked by the client.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Data Contract&lt;/strong&gt;           Defines the structure of data included in the payloads of the messages flowing in&lt;br /&gt;
    and out of the service.&lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;Message Contract&lt;/strong&gt;     Enables the developer to control the headers that appear in the messages and how&lt;br /&gt;
    the messages are structured.&lt;br /&gt;
     &lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Real World Consideration&lt;/h2&gt;
&lt;p&gt;To design real world service contracts, we have leave our object oriented thinking behind.  We have to think in &lt;br /&gt;
terms of messages.  Messages are flowing in and out of the system.  For instance, you might have a &lt;br /&gt;
SignatureScanningService that would recieve a SignatureDocuments in a message payload, which would in turn&lt;br /&gt;
trigger the processing of signature.  This is typically used in banks wherein the clients signature needs to &lt;br /&gt;
be captured and processed.  You can also consider the example of LoanProcessingApplication.  The processing&lt;br /&gt;
may be a long running task, in that case some kind of acknowledgement should be return frrm the service to the&lt;br /&gt;
client.  We have to move towards more document centric thinking.&lt;/p&gt;
&lt;h2&gt;WCF and Web Services Standards&lt;/h2&gt;
&lt;p&gt;The WCF contrcts directly maps to the following web services in the following way.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Service contracts map to WSDL (Web Service Description Language)&lt;/li&gt;
    &lt;li&gt;Data contracts map to XSD (xTensibile Schema Definition)&lt;/li&gt;
    &lt;li&gt;Message contracts map to SOAP (Simple Object Access Protocol) [The abbreviation is no longer important&lt;br /&gt;
    as SOAP is more that a simple object access).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;SOA (Service Oriented Architecture)&lt;/h2&gt;
&lt;p&gt;The following points briefly highlights the essence of SOA.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;A service is a program that performs some task and the client can interact with the service using well-defined&lt;br /&gt;
    contracts.&lt;/li&gt;
    &lt;li&gt;A service-oriented applciation consists of loosely coupled services that communicates through messages&lt;br /&gt;
    and contracts.  They directly don't instantiate the service but interacts through messages.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Principles&lt;/h2&gt;
&lt;ul&gt;
    &lt;li&gt;Boundaries are explicit&lt;br /&gt;
    - Services communicate by sending messages across their boundary.&lt;br /&gt;
    - All communication occur through messages.&lt;br /&gt;
     &lt;/li&gt;
    &lt;li&gt;Services are autonomous&lt;br /&gt;
    - Services are build, managed and version independently.&lt;br /&gt;
    - Services can be changed without affecting clients as long as clients can continue sending and receiving&lt;br /&gt;
      the same messages.&lt;br /&gt;
     &lt;/li&gt;
    &lt;li&gt;Services share contracts and schema&lt;br /&gt;
    - Contracts describe the messages services can send and receive.&lt;br /&gt;
    - Schemas define how the client and service construct the messages they exchange.&lt;br /&gt;
     &lt;/li&gt;
    &lt;li&gt;Compatibility is policy based&lt;br /&gt;
    - Services can define the policiies under which the clients can communicate with them.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the next post we will quickly have a look at the building blocks of WCF and continue our discussion on&lt;br /&gt;
contracts, services, data and messages...&lt;/p&gt;
&lt;p&gt;Cheers till then !!&lt;/p&gt;
&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/rajeshpillai/aggbug/137138.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rajesh Pillai</dc:creator>
            <guid>http://geekswithblogs.net/rajeshpillai/archive/2009/12/20/wcf_1.aspx</guid>
            <pubDate>Sun, 20 Dec 2009 06:45:16 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/rajeshpillai/comments/137138.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/rajeshpillai/archive/2009/12/20/wcf_1.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/rajeshpillai/comments/commentRss/137138.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/rajeshpillai/services/trackbacks/137138.aspx</trackback:ping>
        </item>
    </channel>
</rss>
