soa & wcf
DESCRIPTION
INTRODUCTION TO SERVICE ORIENTED ARCHITECTURE AND WINDOWS COMMUNICATION FOUNDATION PRESENTED IN ASP.NET COMMUNITYTRANSCRIPT
SOA AND WCFSERVICE ORIENTED ARCHITECTURE & WINDOWS COMMUNICATION FOUNDATION
Dev Raj Gautam
Saturday, 18th may, 2013
Asp.NET Community MeetUp
SOASERVICE ORIENTED ARCHITECTURE
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)
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
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
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
UNDERSTANDING THE REAL CONTEXT
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.
WCFWINDOWS COMMUNICATION FOUNDATION
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
Service Interface Service Implementation
UNDERSTANDING THE SERVICE STRUCTURE
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>
WCF END POINTS
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.
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
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
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>
thank you