Introduction to WCF and Differences between WCF and ASMX Web Services Manny Siddiqui Software Architect Data Concepts http...
<ul><li>What is WCF? </li></ul><ul><ul><li>A Scenario </li></ul></ul><ul><ul><li>WCF Architecture </li></ul></ul><ul><ul><...
A Scenario <ul><li>Diverse Communication Requirements </li></ul><ul><ul><li>Call center app </li></ul></ul><ul><ul><ul><li...
<ul><li>Implement with the existing technologies </li></ul><ul><ul><li>No single technology would fit the bill </li></ul><...
WCF – A Unified Programming Model Interop with other platforms ASMX Attribute-  Based Programming Enterprise Services WS-*...
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 + Bi...
WCF Service Hosted in IIS 6.0
WCF and ASP.NET Web Services <ul><li>Migration and Adoption Options </li></ul><ul><ul><li>Continue with ASP.NET Web Servic...
WCF and ASP.NET Web Services ASMX Web Services <ul><li>Message Format </li></ul><ul><ul><li>SOAP </li></ul></ul><ul><li>Me...
WCF and ASP.NET Web Services ASMX Web Services <ul><li>Formatter </li></ul><ul><ul><li>System.Xml.Serialization. </li></ul...
WCF and ASP.NET Web Services ASMX Web Services <ul><li>Hosting </li></ul><ul><ul><li>IIS </li></ul></ul>WCF Web Services <...
WCF and ASP.NET Web Services ASMX Web Services <ul><li>Meta Data </li></ul><ul><ul><li>HTTP GET (?wsdl query string) </li>...
WCF and ASP.NET Web Services ASMX Web Services WCF Web Services
WCF and ASP.NET Web Services ASMX Web Services WCF Web Services <ul><li>Security </li></ul><ul><ul><li>Authentication </li...
WCF and ASP.NET Web Services ASMX Web Services WCF Web Services <ul><li>Security </li></ul><ul><ul><li>Message Confidentia...
WCF and ASP.NET Web Services ASMX Web Services <ul><li>Context </li></ul><ul><ul><li>HttpContext.Current </li></ul></ul>WC...
<ul><li>Mixed Transport Mode </li></ul><ul><ul><li>Default mode </li></ul></ul><ul><ul><li>None of the ASP.NET HTTP specif...
<ul><li>ASP.NET Compatibility Mode </li></ul><ul><ul><li>Enables ASP.NET features for WCF services </li></ul></ul><ul><ul>...
ASP.NET Compatibility Mode
Expose ASMX as WCF
Questions?
Upcoming SlideShare
Loading in...5
×

WCF And ASMX Web Services

4,346

Published on

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.

1 Comment
10 Likes
Statistics
Notes
No Downloads
Views
Total Views
4,346
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
0
Comments
1
Likes
10
Embeds 0
No embeds

No notes for slide
  • Transcript of "WCF And ASMX Web Services"

    1. 1. 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]
    2. 2. <ul><li>What is WCF? </li></ul><ul><ul><li>A Scenario </li></ul></ul><ul><ul><li>WCF Architecture </li></ul></ul><ul><ul><li>Demo (WCF Service hosted in IIS 6.0) </li></ul></ul><ul><li>WCF and ASMX Web Services </li></ul><ul><ul><li>Migration / Adoption Options </li></ul></ul><ul><ul><li>Differences </li></ul></ul><ul><ul><li>Hosting Modes for WCF Services </li></ul></ul><ul><li>Demos </li></ul><ul><ul><li>ASP.NET Compatibility Mode </li></ul></ul><ul><ul><li>Expose ASMX as WCF </li></ul></ul><ul><ul><li>Conversion from ASMX to WCF </li></ul></ul><ul><li>Questions? </li></ul>Agenda
    3. 3. A Scenario <ul><li>Diverse Communication Requirements </li></ul><ul><ul><li>Call center app </li></ul></ul><ul><ul><ul><li>(Performance) </li></ul></ul></ul><ul><ul><li>J2EE and other partner apps </li></ul></ul><ul><ul><ul><li>(Interoperability) </li></ul></ul></ul><ul><ul><li>All applications </li></ul></ul><ul><ul><ul><li>(Security, Transactions) </li></ul></ul></ul>
    4. 4. <ul><li>Implement with the existing technologies </li></ul><ul><ul><li>No single technology would fit the bill </li></ul></ul><ul><ul><li>A combination of more than one technologies will be used </li></ul></ul><ul><ul><ul><li>ASP.NET Web Services </li></ul></ul></ul><ul><ul><ul><li>WSE (WS-Security, WS-Addressing, MTOM) </li></ul></ul></ul><ul><ul><ul><li>.NET Remoting </li></ul></ul></ul><ul><ul><ul><li>COM+ </li></ul></ul></ul><ul><ul><ul><li>MSMQ </li></ul></ul></ul><ul><ul><ul><li>Others </li></ul></ul></ul>Existing Technologies – not so unified
    5. 5. 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
    6. 6. WCF Architecture – from 50000 feet Binding (How) Address (Where) Contract (What)
    7. 7. 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
    8. 8. WCF Service Hosted in IIS 6.0
    9. 9. WCF and ASP.NET Web Services <ul><li>Migration and Adoption Options </li></ul><ul><ul><li>Continue with ASP.NET Web Services (Do nothing) </li></ul></ul><ul><ul><ul><li>Change coding habits </li></ul></ul></ul><ul><ul><li>Use WCF for new development (Side-by-Side) </li></ul></ul><ul><ul><ul><li>Maintain old ASP.NET web service </li></ul></ul></ul><ul><ul><li>Use WCF for new development (Upgrade) </li></ul></ul><ul><ul><ul><li>Migrate old ASP.NET web services </li></ul></ul></ul>SIDE-BY-SIDE UPGRADE Do nothing
    10. 10. WCF and ASP.NET Web Services ASMX Web Services <ul><li>Message Format </li></ul><ul><ul><li>SOAP </li></ul></ul><ul><li>Message Encoding </li></ul><ul><ul><li>Text </li></ul></ul><ul><li>Transport Protocols </li></ul><ul><ul><li>HTTP (s) </li></ul></ul>WCF Web Services <ul><li>Message Format </li></ul><ul><ul><li>SOAP </li></ul></ul><ul><ul><li>Custom </li></ul></ul><ul><li>Message Encoding </li></ul><ul><ul><li>Text </li></ul></ul><ul><ul><li>MTOM </li></ul></ul><ul><li>Transport Protocols </li></ul><ul><ul><li>HTTP (s) </li></ul></ul><ul><ul><li>TCP </li></ul></ul><ul><ul><li>Named Pipe </li></ul></ul><ul><ul><li>MSMQ </li></ul></ul><ul><ul><li>Custom </li></ul></ul>
    11. 11. WCF and ASP.NET Web Services ASMX Web Services <ul><li>Formatter </li></ul><ul><ul><li>System.Xml.Serialization. </li></ul></ul><ul><ul><li>XmlSerializer </li></ul></ul><ul><ul><li>XmlRoot, XmlElement, XmlAttribute and other attributes </li></ul></ul>WCF Web Services <ul><li>Formatter </li></ul><ul><ul><li>System.Runtime.Serialization.DataContractFormatter </li></ul></ul><ul><ul><li>DataContract, DataMember and other attributes </li></ul></ul>
    12. 12. WCF and ASP.NET Web Services ASMX Web Services <ul><li>Hosting </li></ul><ul><ul><li>IIS </li></ul></ul>WCF Web Services <ul><li>Hosting </li></ul><ul><ul><li>IIS 6.0 (HTTP(s) Only) </li></ul></ul><ul><ul><li>IIS 7.0 (WAS – Any protocol) </li></ul></ul><ul><ul><li>Windows Service </li></ul></ul><ul><ul><li>Console Application </li></ul></ul><ul><ul><li>Windows Forms Application </li></ul></ul><ul><ul><li>Any other .NET Process </li></ul></ul>
    13. 13. WCF and ASP.NET Web Services ASMX Web Services <ul><li>Meta Data </li></ul><ul><ul><li>HTTP GET (?wsdl query string) </li></ul></ul><ul><li>Exceptions </li></ul><ul><ul><li>Unhandled exception as SOAPException – contains the actual error </li></ul></ul>WCF Web Services <ul><li>Meta Data </li></ul><ul><ul><li>HTTP GET (?wsdl query string) </li></ul></ul><ul><ul><li>WS-MetadataExchange </li></ul></ul><ul><li>Exceptions </li></ul><ul><ul><li>Unhandled exception as FaultException – does not contain the actual error </li></ul></ul><ul><ul><li>Specifically turn on error reporting for detailed error </li></ul></ul><ul><ul><li>includeExceptionDetailInFaults=&quot;true“ </li></ul></ul><ul><ul><li>Advertise faults in WSDL using FaultContract attribute </li></ul></ul>
    14. 14. WCF and ASP.NET Web Services ASMX Web Services WCF Web Services
    15. 15. WCF and ASP.NET Web Services ASMX Web Services WCF Web Services <ul><li>Security </li></ul><ul><ul><li>Authentication </li></ul></ul><ul><ul><ul><li>IIS Authentication Options </li></ul></ul></ul><ul><ul><li>Authorization </li></ul></ul><ul><ul><ul><li>ACLs </li></ul></ul></ul><ul><ul><ul><li>ASP.NET authorizations </li></ul></ul></ul><ul><ul><ul><li>ASP.NET 2.0 Role Provider </li></ul></ul></ul><ul><ul><li>Message Integrity </li></ul></ul><ul><ul><ul><li>WS-Security (WSE) </li></ul></ul></ul><ul><li>Security </li></ul><ul><ul><li>Authentication </li></ul></ul><ul><ul><ul><li>No IIS/ASP.NET security – Must enable Anonymous access for WCF services in IIS </li></ul></ul></ul><ul><ul><ul><li>WCF Authentication </li></ul></ul></ul><ul><ul><ul><ul><li>Username tokens </li></ul></ul></ul></ul><ul><ul><ul><ul><li>X.509 Certificates </li></ul></ul></ul></ul><ul><ul><ul><ul><li>SAML tokens </li></ul></ul></ul></ul><ul><ul><ul><ul><li>InfoCard </li></ul></ul></ul></ul><ul><ul><li>Authorization </li></ul></ul><ul><ul><ul><li>WCF Authorization </li></ul></ul></ul><ul><ul><ul><ul><li>ACLs ignored </li></ul></ul></ul></ul><ul><ul><ul><ul><li>ASP.NET Role Provider </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Claims-based Authorizations </li></ul></ul></ul></ul><ul><ul><li>Message Integrity </li></ul></ul><ul><ul><ul><li>WS-Security (Built-in) </li></ul></ul></ul>
    16. 16. WCF and ASP.NET Web Services ASMX Web Services WCF Web Services <ul><li>Security </li></ul><ul><ul><li>Message Confidentiality </li></ul></ul><ul><ul><ul><li>HTTPS </li></ul></ul></ul><ul><ul><ul><li>WS-Security (WSE) </li></ul></ul></ul><ul><li>State </li></ul><ul><ul><li>Very flexible; all of the ASP.NET state mechanisms available </li></ul></ul><ul><li>Security </li></ul><ul><ul><li>Message Confidentiality </li></ul></ul><ul><ul><ul><li>HTTPS </li></ul></ul></ul><ul><ul><ul><li>WS-Security (Built-in) </li></ul></ul></ul><ul><li>State </li></ul><ul><ul><li>Extensible objects - not as flexible as ASP.NET state </li></ul></ul>
    17. 17. WCF and ASP.NET Web Services ASMX Web Services <ul><li>Context </li></ul><ul><ul><li>HttpContext.Current </li></ul></ul>WCF Web Services <ul><li>Context </li></ul><ul><ul><li>OperationContext.Current </li></ul></ul><ul><ul><ul><li>End point message was received on </li></ul></ul></ul><ul><ul><ul><li>Incoming/Outgoing message headers and properties </li></ul></ul></ul><ul><ul><ul><li>Request Context </li></ul></ul></ul><ul><ul><ul><li>Instance Context </li></ul></ul></ul><ul><ul><ul><li>Security Context </li></ul></ul></ul><ul><ul><ul><li>Session Id </li></ul></ul></ul><ul><ul><ul><li>Data Extensions </li></ul></ul></ul><ul><ul><ul><li>Callback channel (for duplex calls) </li></ul></ul></ul><ul><ul><ul><li>etc </li></ul></ul></ul>
    18. 18. <ul><li>Mixed Transport Mode </li></ul><ul><ul><li>Default mode </li></ul></ul><ul><ul><li>None of the ASP.NET HTTP specific features are available: </li></ul></ul><ul><ul><ul><li>Intrinsic objects (Context, Session, Request, etc) are null </li></ul></ul></ul><ul><ul><ul><li>File/URL authorization </li></ul></ul></ul><ul><ul><ul><li>ASP.NET impersonation </li></ul></ul></ul><ul><ul><ul><li>Globalization </li></ul></ul></ul><ul><ul><li>Why? </li></ul></ul><ul><ul><ul><li>Any host, any transport, any encoding. WCF is host agnostic. </li></ul></ul></ul><ul><ul><ul><li>Hence, decoupling from HTTP flavored features </li></ul></ul></ul><ul><ul><li>How? </li></ul></ul><ul><ul><ul><li>WCF hooks into the ASP.NET pipe line (machine wide web.config file) – clears out the ASP.NET objects </li></ul></ul></ul><ul><ul><li>What’s the use of IIS then? </li></ul></ul><ul><ul><ul><li>Hosting – provides many features related to the worker process life time, threading, etc. </li></ul></ul></ul><ul><ul><ul><li>Scalable host – could you used in the load balanced scenarios </li></ul></ul></ul><ul><ul><ul><li>IIS 7.0 will let you use any protocol </li></ul></ul></ul>Hosting Modes for WCF Services
    19. 19. <ul><li>ASP.NET Compatibility Mode </li></ul><ul><ul><li>Enables ASP.NET features for WCF services </li></ul></ul><ul><ul><ul><li><serviceHostingEnvironment aspNetCompatibilityEnabled=&quot;true&quot; /> </li></ul></ul></ul><ul><ul><ul><li>Apply [AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode. </li></ul></ul></ul><ul><ul><ul><li>Allowed) to the service class </li></ul></ul></ul><ul><ul><li>All of the ASP.NET HTTP specific features available </li></ul></ul><ul><ul><ul><li>Session state is the primary reason </li></ul></ul></ul><ul><ul><ul><li>Throws error for non-HTTP protocols </li></ul></ul></ul><ul><ul><li>How? </li></ul></ul><ul><ul><ul><li>WCF module does not clear out the ASP.NET objects </li></ul></ul></ul>Hosting Modes for WCF Services
    20. 20. ASP.NET Compatibility Mode
    21. 21. Expose ASMX as WCF
    22. 22. Questions?

    ×