Top Banner
Microsoft Visual Studio 2010 Muhammad Zubair MS (FAST-NU) Experience: 5+ Years Contact:- Cell#: +923004446625 Email:- [email protected]
36

Microsoft Visual Studio 2010

Jan 02, 2016

Download

Documents

nayda-mckinney

Microsoft Visual Studio 2010. Muhammad Zubair MS (FAST-NU) Experience: 5+ Years Contact:- Cell#: +923004446625 Email:- [email protected]. Introducing Windows Communication Foundation (WCF). Next Generation Connected System on Windows. In this Lecture. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Microsoft Visual Studio 2010

MicrosoftVisual Studio 2010

Muhammad ZubairMS (FAST-NU)Experience: 5+ Years

Contact:-Cell#: +923004446625Email:- [email protected]

Page 2: Microsoft Visual Studio 2010

Introducing Windows Communication Foundation (WCF)•Next Generation Connected System on

Windows

Page 3: Microsoft Visual Studio 2010

In this Lecture

•Connected Systems Overview•The move towards “Services”•Service-Orientation•Introduction to WCF•WCF Programming model basics•Common WCF Questions

Page 4: Microsoft Visual Studio 2010

What is Connected Systems?

Development of distributed applications under service-oriented architecture (SOA).

Interface

Interface

An Application that is distributed across multiple computer nodes

Page 5: Microsoft Visual Studio 2010

WCF

Internet -HTTP

Intranet -TCP

How it works?

Page 6: Microsoft Visual Studio 2010

What Is Windows Communication Foundation?• .NET Framework provided WCF to build

distributed Applications and services.▫ In older days COM, COM+, DCOM, Web Services

using XML, SOAP, JSON etc

• WCF provides a model with which you can implement services that conform to many commonly-accepted styles and standards, including SOAP, XML, and JSON. Additionally, WCF supports many Microsoft-specific technologies for building components, such as Enterprise Services and Microsoft Message Queue (MSMQ), and supports a unified programming model for many of these technologies.

Page 7: Microsoft Visual Studio 2010

Windows Communication Foundation

Technologies work within the same network environment , specific to Microsoft family OSsuch as COM, DCOM, COM+, Enterprise Services, and .NET Framework Remoting

Technologies work within the same network environment and over WWWsuch as web services

Page 8: Microsoft Visual Studio 2010

Windows Communication FoundationMoving towards Services• Market Demand for technology freedom and interoperability is

common now• Services exposes units of functionality via messaging• Interop achived via Standard Protocols and message formats

Application

Windows“I do .NET!”

Service

Linux“I do Java!”

Service

Mainframe“I do Cobol!”

Service

HTTP

HTTP

HTTP

XML

SOAP

RSS

Page 9: Microsoft Visual Studio 2010

Service Design Philosophies

Service Oriented Architecture Protocol

Representational State Transfer

Typically used in Enterprise

Applications

Typically used in Public Facing Web

Scenarios

Page 10: Microsoft Visual Studio 2010

SOAP

Transaction

Page 11: Microsoft Visual Studio 2010

SOAP Format

•Envelope•Header• Security• RM• Transactions

•Body• XML Format

Page 12: Microsoft Visual Studio 2010

RESTful Services

• RESTful services typically embrace HTTP, the “Web” transport.▫ HTTP methods GET, PUT, POST, or DELETE etc

• Services are modeled as “Resources” as with Unique Identifiers (URI’s)▫ www.myWebsite.com/POST /invoice/123▫ www.myWebsite.com/PUT/invoice/123▫ www.myWebsite.com/GET/invoice/123▫ www.myWebsite.com/DELETE/invoice/123

• Resources can be presented as XML, RSS, JSON etc

Page 13: Microsoft Visual Studio 2010

SOA (Service Oriented Architecture)

•SOA is a design paradigm for separation of concerns.▫Focused on autonomy, explicit boundaries,

contracts & policies.▫Design principles help achieve a Service

Oriented Architecture.▫SOA says nothing about technology – room

for both SOAP & REST

Page 14: Microsoft Visual Studio 2010

Windows Communication Foundation

Technologies work within the same network environment , specific to Microsoft family OSsuch as COM, DCOM, COM+, Enterprise Services, and .NET Framework Remoting

Technologies work within the same network environment and over WWWsuch as web services

Page 15: Microsoft Visual Studio 2010

The Ideal Communication framework

Page 16: Microsoft Visual Studio 2010

Introducing WCF•WCF namespace

▫System.ServiceModel.dll•Just one way to write the code

Application

Computer 1WCF ServiceWCF Service

Computer 3WCF Service

Computer 2WCF Service

MSMQ

Binary

HTTP

RSS

TCP

SOAP

Distributed Object Style

SOAP based

RESTful Style

Page 17: Microsoft Visual Studio 2010

Just one way to write code•Interfaces•Services Contracts

Page 18: Microsoft Visual Studio 2010

Many ways to connect with dots•Endpoints

▫Configure endpoints to different communication options.

Rest over HTTP

SOAP + WS-* over MSMQ

SOAP + WS-*over TCP

Page 19: Microsoft Visual Studio 2010

Create WCF Service

Page 20: Microsoft Visual Studio 2010

Create WCF Service•Auto Generated Code

▫Two Service Files Interface Service

▫Interface using namespace “System.ServiceModel”

Define “Service Contract” Define “Operation Contract”

Page 21: Microsoft Visual Studio 2010

Create WCF Service▫Service

Implement “Interface” in the Service class Write “Operation Contracts” in Service class

Page 22: Microsoft Visual Studio 2010

Create WCF Service

•System.ServiceModel.Web▫The System.ServiceModel.Web namespace

contains types that you can use to build WCF services

Page 23: Microsoft Visual Studio 2010

Create WCF Service

•System.Runtime.Serialization ▫WCF uses the classes in the

System.Runtime.Serialization namespace to convert objects into a stream of data suitable for transmitting over the network (a process known as serialization). It also uses them to convert a stream of data received from the network back into objects (deserialization)

Page 24: Microsoft Visual Studio 2010

Create WCF Service

•Contracts▫Data Contracts

Namespace:- System.Runtime.Serialization Data Member (Expose Members)

▫Service Contracts Namespace:- System.ServiceModel Used in Interface Operation Contract (Expose Operation

Members)▫Operation Contract ▫Method Contract

Page 25: Microsoft Visual Studio 2010
Page 26: Microsoft Visual Studio 2010

App.Config•Configure “EndPoints”

Page 27: Microsoft Visual Studio 2010

Create WCF Service•Service Configuration

Page 28: Microsoft Visual Studio 2010

Service Configuration

• EndPoints▫ All communication with a Windows Communication

Foundation (WCF) service occurs through the endpoints of the service

▫ Each endpoint consists of four properties: Address

An address that indicates where the endpoint can be found. 

Binding A binding that specifies how a client can communicate

with the endpoint.  Contract

A contract that identifies the operations available.  Behavior

A set of behaviors that specify local implementation details of the endpoint. 

Page 29: Microsoft Visual Studio 2010

Service Configuration

• Structure of EndPoints▫ Address

The address uniquely identifies the endpoint and tells potential consumers of the service where it is located. It is represented in the WCF object model by the EndpointAddress class. An EndpointAddress class contains: URI Property

http://msdn.microsoft.com/en-us/library/ms733107.aspx

Page 30: Microsoft Visual Studio 2010
Page 31: Microsoft Visual Studio 2010

Bindings

Page 32: Microsoft Visual Studio 2010

Server Side Services

Page 33: Microsoft Visual Studio 2010

WCF Soap Services

Page 34: Microsoft Visual Studio 2010

WCF Soap Service Design Style

•Fire and Forget▫One way messaging▫No response.▫No Error response

•Remote Procedure Calls▫Request / Response

•Out of process interactions

Page 35: Microsoft Visual Studio 2010

WCF vs Web Api• WCF is Microsoft’s unified programming model for

building service-oriented applications. It enables developers to build secure, reliable, transacted solutions that integrate across platforms and interoperate with existing investments.

• ASP.NET Web APIis a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework. This topic presents some guidance to help you decide which technology will best meet your needs.

Page 36: Microsoft Visual Studio 2010

WCF vs Web Api