WCF And ASMX Web Services

45 %
55 %
Information about WCF And ASMX Web Services

Published on December 6, 2008

Author: mannysiddiqui

Source: slideshare.net

Description

This presentation is about WCF and ASP.NET web services. The WCF architecture is introduced in detail and then the differences between WCF services and ASP.NET web services have been discussed.

Introduction to WCF and Differences between WCF and ASMX Web Services Manny Siddiqui Software Architect Data Concepts http://www.techconception.com http://blogs.techconception.com/manny [email_address]

What is WCF? A Scenario WCF Architecture Demo (WCF Service hosted in IIS 6.0) WCF and ASMX Web Services Migration / Adoption Options Differences Hosting Modes for WCF Services Demos ASP.NET Compatibility Mode Expose ASMX as WCF Conversion from ASMX to WCF Questions? Agenda

What is WCF?

A Scenario

WCF Architecture

Demo (WCF Service hosted in IIS 6.0)

WCF and ASMX Web Services

Migration / Adoption Options

Differences

Hosting Modes for WCF Services

Demos

ASP.NET Compatibility Mode

Expose ASMX as WCF

Conversion from ASMX to WCF

Questions?

A Scenario Diverse Communication Requirements Call center app (Performance) J2EE and other partner apps (Interoperability) All applications (Security, Transactions)

Diverse Communication Requirements

Call center app

(Performance)

J2EE and other partner apps

(Interoperability)

All applications

(Security, Transactions)

Implement with the existing technologies No single technology would fit the bill A combination of more than one technologies will be used ASP.NET Web Services WSE (WS-Security, WS-Addressing, MTOM) .NET Remoting COM+ MSMQ Others Existing Technologies – not so unified

Implement with the existing technologies

No single technology would fit the bill

A combination of more than one technologies will be used

ASP.NET Web Services

WSE (WS-Security, WS-Addressing, MTOM)

.NET Remoting

COM+

MSMQ

Others

WCF – A Unified Programming Model Interop with other platforms ASMX Attribute- Based Programming Enterprise Services WS-* Protocol Support WSE Message- Oriented Programming System.Messaging Extensibility Location transparency .NET Remoting

WCF Architecture – from 50000 feet Binding (How) Address (Where) Contract (What)

WCF Architecture – End Point Client Service Message Address Binding Contract (Where) (How) (What) End Point = Address + Binding + Contract A B C A B C A B C

WCF Service Hosted in IIS 6.0

WCF and ASP.NET Web Services Migration and Adoption Options Continue with ASP.NET Web Services (Do nothing) Change coding habits Use WCF for new development (Side-by-Side) Maintain old ASP.NET web service Use WCF for new development (Upgrade) Migrate old ASP.NET web services SIDE-BY-SIDE UPGRADE Do nothing

Migration and Adoption Options

Continue with ASP.NET Web Services (Do nothing)

Change coding habits

Use WCF for new development (Side-by-Side)

Maintain old ASP.NET web service

Use WCF for new development (Upgrade)

Migrate old ASP.NET web services

WCF and ASP.NET Web Services ASMX Web Services Message Format SOAP Message Encoding Text Transport Protocols HTTP (s) WCF Web Services Message Format SOAP Custom Message Encoding Text MTOM Transport Protocols HTTP (s) TCP Named Pipe MSMQ Custom

Message Format

SOAP

Message Encoding

Text

Transport Protocols

HTTP (s)

Message Format

SOAP

Custom

Message Encoding

Text

MTOM

Transport Protocols

HTTP (s)

TCP

Named Pipe

MSMQ

Custom

WCF and ASP.NET Web Services ASMX Web Services Formatter System.Xml.Serialization. XmlSerializer XmlRoot, XmlElement, XmlAttribute and other attributes WCF Web Services Formatter System.Runtime.Serialization.DataContractFormatter DataContract, DataMember and other attributes

Formatter

System.Xml.Serialization.

XmlSerializer

XmlRoot, XmlElement, XmlAttribute and other attributes

Formatter

System.Runtime.Serialization.DataContractFormatter

DataContract, DataMember and other attributes

WCF and ASP.NET Web Services ASMX Web Services Hosting IIS WCF Web Services Hosting IIS 6.0 (HTTP(s) Only) IIS 7.0 (WAS – Any protocol) Windows Service Console Application Windows Forms Application Any other .NET Process

Hosting

IIS

Hosting

IIS 6.0 (HTTP(s) Only)

IIS 7.0 (WAS – Any protocol)

Windows Service

Console Application

Windows Forms Application

Any other .NET Process

WCF and ASP.NET Web Services ASMX Web Services Meta Data HTTP GET (?wsdl query string) Exceptions Unhandled exception as SOAPException – contains the actual error WCF Web Services Meta Data HTTP GET (?wsdl query string) WS-MetadataExchange Exceptions Unhandled exception as FaultException – does not contain the actual error Specifically turn on error reporting for detailed error includeExceptionDetailInFaults="true“ Advertise faults in WSDL using FaultContract attribute

Meta Data

HTTP GET (?wsdl query string)

Exceptions

Unhandled exception as SOAPException – contains the actual error

Meta Data

HTTP GET (?wsdl query string)

WS-MetadataExchange

Exceptions

Unhandled exception as FaultException – does not contain the actual error

Specifically turn on error reporting for detailed error

includeExceptionDetailInFaults="true“

Advertise faults in WSDL using FaultContract attribute

WCF and ASP.NET Web Services ASMX Web Services WCF Web Services

WCF and ASP.NET Web Services ASMX Web Services WCF Web Services Security Authentication IIS Authentication Options Authorization ACLs ASP.NET authorizations ASP.NET 2.0 Role Provider Message Integrity WS-Security (WSE) Security Authentication No IIS/ASP.NET security – Must enable Anonymous access for WCF services in IIS WCF Authentication Username tokens X.509 Certificates SAML tokens InfoCard Authorization WCF Authorization ACLs ignored ASP.NET Role Provider Claims-based Authorizations Message Integrity WS-Security (Built-in)

Security

Authentication

IIS Authentication Options

Authorization

ACLs

ASP.NET authorizations

ASP.NET 2.0 Role Provider

Message Integrity

WS-Security (WSE)

Security

Authentication

No IIS/ASP.NET security – Must enable Anonymous access for WCF services in IIS

WCF Authentication

Username tokens

X.509 Certificates

SAML tokens

InfoCard

Authorization

WCF Authorization

ACLs ignored

ASP.NET Role Provider

Claims-based Authorizations

Message Integrity

WS-Security (Built-in)

WCF and ASP.NET Web Services ASMX Web Services WCF Web Services Security Message Confidentiality HTTPS WS-Security (WSE) State Very flexible; all of the ASP.NET state mechanisms available Security Message Confidentiality HTTPS WS-Security (Built-in) State Extensible objects - not as flexible as ASP.NET state

Security

Message Confidentiality

HTTPS

WS-Security (WSE)

State

Very flexible; all of the ASP.NET state mechanisms available

Security

Message Confidentiality

HTTPS

WS-Security (Built-in)

State

Extensible objects - not as flexible as ASP.NET state

WCF and ASP.NET Web Services ASMX Web Services Context HttpContext.Current WCF Web Services Context OperationContext.Current End point message was received on Incoming/Outgoing message headers and properties Request Context Instance Context Security Context Session Id Data Extensions Callback channel (for duplex calls) etc

Context

HttpContext.Current

Context

OperationContext.Current

End point message was received on

Incoming/Outgoing message headers and properties

Request Context

Instance Context

Security Context

Session Id

Data Extensions

Callback channel (for duplex calls)

etc

Mixed Transport Mode Default mode None of the ASP.NET HTTP specific features are available: Intrinsic objects (Context, Session, Request, etc) are null File/URL authorization ASP.NET impersonation Globalization Why? Any host, any transport, any encoding. WCF is host agnostic. Hence, decoupling from HTTP flavored features How? WCF hooks into the ASP.NET pipe line (machine wide web.config file) – clears out the ASP.NET objects What’s the use of IIS then? Hosting – provides many features related to the worker process life time, threading, etc. Scalable host – could you used in the load balanced scenarios IIS 7.0 will let you use any protocol Hosting Modes for WCF Services

Mixed Transport Mode

Default mode

None of the ASP.NET HTTP specific features are available:

Intrinsic objects (Context, Session, Request, etc) are null

File/URL authorization

ASP.NET impersonation

Globalization

Why?

Any host, any transport, any encoding. WCF is host agnostic.

Hence, decoupling from HTTP flavored features

How?

WCF hooks into the ASP.NET pipe line (machine wide web.config file) – clears out the ASP.NET objects

What’s the use of IIS then?

Hosting – provides many features related to the worker process life time, threading, etc.

Scalable host – could you used in the load balanced scenarios

IIS 7.0 will let you use any protocol

ASP.NET Compatibility Mode Enables ASP.NET features for WCF services <serviceHostingEnvironment aspNetCompatibilityEnabled=&quot;true&quot; /> Apply [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode. Allowed) to the service class All of the ASP.NET HTTP specific features available Session state is the primary reason Throws error for non-HTTP protocols How? WCF module does not clear out the ASP.NET objects Hosting Modes for WCF Services

ASP.NET Compatibility Mode

Enables ASP.NET features for WCF services

<serviceHostingEnvironment aspNetCompatibilityEnabled=&quot;true&quot; />

Apply [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.

Allowed) to the service class

All of the ASP.NET HTTP specific features available

Session state is the primary reason

Throws error for non-HTTP protocols

How?

WCF module does not clear out the ASP.NET objects

ASP.NET Compatibility Mode

Expose ASMX as WCF

Questions?

Add a comment

Related presentations

Related pages

What are the differences between WCF and ASMX web services ...

ASMX Web services can only be invoked by HTTP (traditional webservice with .asmx). While WCF Service or a WCF component can be invoked by any protocol ...
Read more

Differences Between ASMX and WCF Services

The Web Service Software Factory is now maintained by the community and can be found on the Service Factory site. This content is outdated and is no longer ...
Read more

WCF Vs ASMX Web Services - WCF Tutorial

Brief discussion on difference between WCF services and ASMX web services | WCF Vs Web services | WCF Vs ASMX.
Read more

What's the Difference between WCF and Web Services ...

Difference between ASP.NET web service and programming WCF services like ASP.NET web services ... WCF than through traditional ASMX because WCF is ...
Read more

Web Service vs WCF Service - Stack Overflow

Web Service vs WCF Service. ... WCF provides better security and reliability as compared to web services or ASMX ... WCF "web services" are part of a much ...
Read more

Migrating ASMX Services to WCF Services - CodeProject

Many companies still have Web Services that are currently ... Two different projects are created on the ServiceLayer that provides ASMX and WCF services ...
Read more

WCF, ASMX and other Web Services | The ASP.NET Forums

All about building Web Services with ASP.NET - WCF, ASMX, SOAP, WSDL, etc.
Read more

WCF VS ASMX Web Services - gallery.technet.microsoft.com

WCF VS ASMX Web Services First of all, it needs to understand that WCF Service provides all the capabilities of .NET web services and further extends it.
Read more

Calling a WCF service from a ASMX client

... 4c8b-a52b-cc16afbf4779/calling-a-wcf-service-from-a-asmx-client?forum=wcf ... (WCF), and Web Services. 0 0 ... web.config in the WCF service ...
Read more

Migrating ASP.NET Web Services to WCF

Migrating ASP.NET Web Services to WCF. ... including those used by Web services. Migrating ASP.NET Web Services to WCF allows your applications to take ...
Read more