Jinaldesai.

net – My Thouths And Learnings

OVERVIEW OF SOA AND WCF

AGENDA
Jinaldesai.net – My Thouths And Learnings

Overview of Service Oriented Architecture (SOA) Overview of WCF

Introducing WCF Contracts

WHAT IS SERVICES?

Service is unit of logic(functionality). Example of services are placing airline ticket order online or viewing an online bank statement.

Jinaldesai.net – My Thouths And Learnings

Services are loosely coupled.

Service interface is independent of implementation.

Services are reusable.

Service Can access another service for performing it’s task.net – My Thouths And Learnings   Service is relatively independent of other service or software. or provides business data and technical details like details needed for constructing GUI.SERVICE CHARACTERISTICS  Handles a business process like calculating insurance quote. or handles relatively technical task like accessing a database. . Jinaldesai.

SOA defines how two computing entities. interact in such a way as to enable one entity to perform a unit of work on behalf of another entity. It comprises of one or more services. Jinaldesai. such as program.net – My Thouths And Learnings    .WHAT IS SOA?  Service Oriented Architecture is an evolution of distributed computing. Each interaction is independent of any other interaction or it’s implementation.

Key Qos elements are security requirements.SOA KEY CHARACTERISTICS  SOA services have self-describing interfaces in platform-independent XML Document(WSDL). reliable messaging and other policies regarding who can invoke services.  . Jinaldesai.net – My Thouths And Learnings   SOA services are maintained in the enterprise by a registry that acts as a directory listing(UDDI) Each SOA service has a quality of service(QoS). SOA Services communicate with messages formally defined via XML schema(XSD).

Jinaldesai.net – My Thouths And Learnings STRUCTURE OF SOA .

Jinaldesai.STRUCTURE OF SOA  The topmost level contains one or more integration services.  . each of which controls a flow of activities such as processing an applicant's request. Each integration service invokes one or more business services. The third level data access services handles relatively technical task of reading from and writing to data-storage areas such as databases/message queues.net – My Thouths And Learnings  The second level is composed of services that each fulfill a relatively low-level business task.

Jinaldesai.net – My Thouths And Learnings DISTRIBUTED APPLICATIONS .

DISTRIBUTED APPLICATION ON WINDOWS  Microsoft shipped many communication frameworks to achieve connected system environment.net – My Thouths And Learnings  Disadvantages: Each framework comes up with a unique programming model. Jinaldesai.  .  Each of these framework can be used only in windows platform.

SERVICES COMMUNICATION  ™ S ervices were used to expose the units of functionality via messages. Jinaldesai.net – My Thouths And Learnings .

SOAP AND REST ™ T o make a service available over http can be done by exposing a SOAP based service or using a REST( non SOAP) based service.  REST ™  . Which operates on resources through a unified interface(HTTP).net – My Thouths And Learnings XML Messaging using SOAP as the format. ™ SOAP   Jinaldesai. Typically used in public facing web scenarios. enhanced with the WS-* protocols(can be used with any transport protocol). Typically used in enterprise.

 It is a fusion of current distributed system technologies designed and developed with the goal of achieving SOA based development.  WCF has been built to facilitate the development of service-oriented applications.WHAT IS WCF? ™CF is the Microsoft next generation technology W for developing distributed applications.net – My Thouths And Learnings .  Jinaldesai.

WHAT IS WCF?  WCF is a programming model that enables developers to build service solutions that are reliable and secure.net – My Thouths And Learnings  . Jinaldesai. It simplifies development of connected applications and offers a unified. and even transacted. and manageable distributed system development approach. simplified.

Jinaldesai.net – My Thouths And Learnings WHAT DOES WCF SOLVE? .

Jinaldesai.net – My Thouths And Learnings WHY HANDLE UNIFICATION? .

Jinaldesai.net – My Thouths And Learnings UNIFICATION OF DISTRIBUTED TECHNOLOGIES .

net – My Thouths And Learnings WCF IN .Jinaldesai.NET FRAMEWORK STACK .

 The Layers are:  Contracts  Service Runtime  Messaging  Activation and Hosting  .WCF ARCHITECTURE Jinaldesai.net – My Thouths And Learnings At the heart of WCF is a layered architecture that supports a lot of the distributed application development styles.

net – My Thouths And Learnings   Service Contracts Operation Contracts Data Contracts Message Contracts Fault Contracts . They are created in code by service developers. and are exposed to clients in the service metadata The five types of contracts:      Jinaldesai.CONTRACTS  WCF contracts define the functionality of WCF services.WCF LAYERS .

 Instance Behavior: Drives how many instances of the service will be available to process messages.SERVICE RUNTIME  The Service Runtime layer is the layer that specifies and manages the behaviors of the service that occur during service operation. or service runtime.net – My Thouths And Learnings  Some of them are as follows: Metadata Behavior: Controls whether or not metadata is exposed to the outside world.WCF LAYERS .  Transaction Behavior: Enables transacted operations. Jinaldesai.  .

Client applications can be developed to access this layer and control messaging details and work directly with messages and channels.MESSAGING  The messaging layer defines what formats and data exchange patterns can be used during service communication. Some of the Channels and components are as follows:    Jinaldesai.WCF LAYERS .net – My Thouths And Learnings   HTTP Channel TCP Channel MSMQ Channel .

Services can also be hosted. Like other programs. A service can also be run automatically as a Windows service. a service must be run in an executable. or run in an executable managed by an external agent. Jinaldesai. such as IIS or Windows Activation Service (WAS). This is known as a self-hosted service. WAS enables WCF applications to be activated automatically when deployed on a computer running WAS. a service is a program.exe files). Services can also be manually run as executable (. COM+ components can also be hosted as WCF services.net – My Thouths And Learnings   .WCF LAYERS – ACTIVATION & HOSTING  In its final form.

An endpoint is the component of the service that communicates with the client and provides the service operations. Jinaldesai. which makes it distinguishable from the other endpoints on the service.net – My Thouths And Learnings . A service must have at least one endpoint. Each endpoint has its very own address.WCF SERVICE FROM THE OUTSIDE      A service is a collection of one or more endpoints.

Jinaldesai.net – My Thouths And Learnings WCF SERVICE FROM THE INSIDE  .

[ServiceContract] public interface IBookOrder { … } Jinaldesai.NET Framework interfaces that are annotated with the ServiceContract attribute.net – My Thouths And Learnings  .WCF CONTRACTS – SERVICE CONTRACTS  A service contract defines the operations that a service supports. Service contracts are implemented as . and maps to a portType in Web Service Description Language (WSDL).

Operations are defined by adding methods to a Service Contract interface that is annotated with the OperationContract attribute. [OperationContract] void SomeOperation().net – My Thouths And Learnings  . Jinaldesai.WCF CONTRACTS – OPERATION CONTRACTS  Operation contracts define the individual operations that a service supports and map to operations in WSDL.

User defined object are explicit or Complex type. set. string etc has an implicit data contract.WCF CONTRACTS – DATA CONTRACTS   A data contract is a formal agreement between a service and a client that abstractly describes the data to be exchanged. for which you have to define a Data contract using [DataContract] and [DataMember] attribute.net – My Thouths And Learnings Simple type such as int.   Jinaldesai. set. [DataContract] Class Employee { [DataMember] public string FirstName { get. } [DataMember] public string LastName { get. Data contract can be explicit or implicit. } } .

In most of the cases WCF will automatically take care of message. Jinaldesai. WCF uses these messages to transfer information from Source to destination.net – My Thouths And Learnings   . Request/Reply – two way communication but at a time only one can send a message and Duplex – two way communication both source and destination can send message simultaneously.WCF CONTRACTS – MESSAGE CONTRACTS  Message: Message is the packet of data which contains important information. Message Pattern: It describes how the programs will exchange message with each other. In that case WCF provides Message Contract to customize the message as per requirement. but at some point developer will also require control over the SOAP message format. It can be Simplex – one way communication.

WCF supports either RPC(Remote Procedure Call) or Message style operation model. In the RPC model. you can develop operation with Ref and out parameter.net – My Thouths And Learnings    . In Message style operation WCF allows to customize the message header and define the security for header and body of the message. that is.WCF CONTRACTS – MESSAGE CONTRACTS  The most common scenario for this is inserting custom SOAP headers. WCF will automatically create the message for operation at run time. Jinaldesai. Another common scenario is to define security properties for the message’s headers and body. to decide whether these elements are digitally signed and encrypted.

net – My Thouths And Learnings . } Jinaldesai. Custom header and body can be included to message using MessageHeader and MessageBodyMember attribute.WCF CONTRACTS – MESSAGE CONTRACTS  Defining Message Contracts: Message contract can be applied to type using MessageContract attribute. [MessageBodyMember] public string Designation. [MessageContract] public class EmployeeDetails { [MessageHeader] public string EmpID. [MessageBodyMember] public string Name.

WCF provides the option to handle and convey the error message to client from service using SOAP Fault contract. In addition. therefore. it will not reach the client side. create a fault contract that clients can use to make their operation more interactive.net – My Thouths And Learnings   .WCF CONTRACTS – FAULT CONTRACTS  By default when we throw any exception from service. Jinaldesai. SOAP faults are message types that are included in the metadata for a service operation and. because SOAP faults are expressed to clients in XML form. they are highly interoperable.

WCF CONTRACTS – FAULT CONTRACTS Fault Contract Example: [ServiceContract()] public interface IService { [OperationContract] [FaultContract (typeof(MyFaultExcepti on))] string GetMessage(). } [DataContract] public class MyFaultException { private string _reason. } set { _reason = value. [DataMember] public string Reason { get { return _reason. } } } Jinaldesai.net – My Thouths And Learnings .

Jinaldesai.net – My Thouths And Learnings THANKS .

Sign up to vote on this title
UsefulNot useful