SOA & WCF

21
SOA AND WCF SERVICE ORIENTED ARCHITECTURE & WINDOWS COMMUNICATION FOUNDATION Dev Raj Gautam Saturday, 18th may, 2013 Asp.NET Community MeetUp

description

INTRODUCTION TO SERVICE ORIENTED ARCHITECTURE AND WINDOWS COMMUNICATION FOUNDATION PRESENTED IN ASP.NET COMMUNITY

Transcript of SOA & WCF

Page 1: SOA & WCF

SOA AND WCFSERVICE ORIENTED ARCHITECTURE & WINDOWS COMMUNICATION FOUNDATION

Dev Raj Gautam

Saturday, 18th may, 2013

Asp.NET Community MeetUp

Page 2: SOA & WCF

SOASERVICE ORIENTED ARCHITECTURE

Page 3: SOA & WCF

SOA

SOA or Service oriented architecture is an architecture style for building business applications by means of

services. Application comprises collection of services which communicate through messages.

Widely used in various programming platforms e.g. Net , Java etc.

Consists set of components which can be invoked, and whose interface descriptions can be published and

discovered (W3C).

Services are consumed by software service consumers (also known as clients or service requesters)

Page 4: SOA & WCF
Page 5: SOA & WCF

SERVICES IN SOA

A service is a self-contained unit of software that performs a specific task

Add a new customer, send an e-mail, register user etc.

It has three components:

Interface defines how a service provider will perform requests from a service consumer

Contract defines how the service provider and the service consumer should interact

implementation is the actual service code itself

Page 6: SOA & WCF

MESSAGES IN SOA

Services communicate with each other using messages. Messages are standard formats which everyone (every

service) can read and understand.

Services communicate via standard Messages standard messages, which make them platform independent

Page 7: SOA & WCF

WHY TO USE SOA? (IN SIMPLE TERMS)

Exposing services ensures clients get data without directly connecting to data source.

Process Reusability among different platforms

Different UI can access for same process and data source

Tackle heterogeneous technology stack

Page 8: SOA & WCF

UNDERSTANDING THE REAL CONTEXT

Page 9: SOA & WCF

HOW IS COMMUNICATION POSSIBLE AMONG HETEROGONOUS

PLATFORM? --SOAP

By using the World Wide Web's Hypertext Transfer Protocol (HTTP) and its Extensible Markup Language (XML)

as the mechanisms for information exchange

SOAP specifies exactly how to encode an HTTP header and an XML file so that a program in one computer can

call a program in another computer and pass it information. It also specifies how the called program can return a

response.

Page 10: SOA & WCF
Page 11: SOA & WCF

WCFWINDOWS COMMUNICATION FOUNDATION

Page 12: SOA & WCF

WCF

The Windows Communication Foundation (or WCF), previously known as "Indigo", is a runtime and a set of APIs

(Application Programming Interface) in the .NET Framework for building connected service-oriented applications

(Wikipedia).

Using WCF, you can send data as asynchronous messages from one service endpoint to another

Multiple technologies at one place - WCF unites following four technologies.NET remoting

MSMQ

Web Services

COM+

.Net Remoting

Page 13: SOA & WCF

Service Interface Service Implementation

Page 14: SOA & WCF

UNDERSTANDING THE SERVICE STRUCTURE

Page 15: SOA & WCF

SAMPLE REQUEST AND RESPONSE FROM WCF

Request

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

<s:Header>

<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IService1/GetData</Action>

</s:Header>

<s:Body>

<GetData xmlns="http://tempuri.org/">

<value>1</value>

</GetData>

</s:Body>

</s:Envelope>

Response

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">

<s:Header />

<s:Body>

<GetDataResponse xmlns="http://tempuri.org/">

<GetDataResult>You entered: 1</GetDataResult>

</GetDataResponse>

</s:Body>

</s:Envelope>

Page 16: SOA & WCF

WCF END POINTS

Page 17: SOA & WCF

ABC OF WCF ENDPOINTS

Address(Where?): Specifies the location of the service which will be like http://Myserver/MyService.Clients will

use this location to communicate with our service.

Binding-Address(How?): Specifies how the two parties will communicate in terms of transport and encoding

and protocols.

Contract(What?): Specifies the interface between client and the server. It's a simple interface with some

attribute.

Page 18: SOA & WCF

FLEXIBILITY OF HOSTING OPTIONS IN WCF

Self-Hosting Your Service :A managed .NET application can host the wcf service itself,

Hosting in Windows Services

Hosting Using Internet Information Services

Page 19: SOA & WCF

WSDL IN WCF (DOCUMENTING FOR CLIENTS)

WSDL documentation generation can be specified by [WSDLDocumentation (“”)] tag in service interface.

Service, operations and input/output parameter descriptions are added to WSDL

Page 20: SOA & WCF

SAMPLE WSDL

<WSDL:message name="EchoStringSoapIn">

<WSDL:part name="parameters" element="tns:EchoString" />

</WSDL:message>

...

<WSDL:operation name="EchoString">

<WSDL:input message="tns:EchoStringSoapIn" />

<WSDL:output message="tns:EchoStringSoapOut" />

</WSDL:operation>

Page 21: SOA & WCF

thank you