1 / 46

Messaging with Web Services Enhancements 2.0

Messaging with Web Services Enhancements 2.0. Benjamin Mitchell Independent Consultant Microsoft Regional Director – UK Blog http://benjaminm.net/ benjaminm@benjaminm.net. What We Will Cover:. Overview of Web Services Enhancements 2.0 What problems does Messaging solve?

gaetan
Download Presentation

Messaging with Web Services Enhancements 2.0

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Messaging with Web Services Enhancements 2.0 Benjamin Mitchell Independent Consultant Microsoft Regional Director – UK Blog http://benjaminm.net/ benjaminm@benjaminm.net

  2. What We Will Cover: • Overview of Web Services Enhancements 2.0 • What problems does Messaging solve? • Why does Messaging solve them? • What types of Messaging models are there? • How can I use these programming models today?

  3. Web Services Enhancements • WSE implements many WS-* specifications • Simple, low-level object model for developers • Available for free download • Logically part of the .NET Framework, but kept separate while still evolving • Fully supported by Microsoft until at least 2008 • Version 1.0 Dec 2002, Version 2.0 May 2004 • Version 2.0 SP 2 pre-release available now • Benefits • Allows MS to gather real world feedback • Allows early adopters to use the latest standards

  4. WSE 2.0 • Designed to bring advanced Web Services technologies based on standard protocols to developers • Integrates with Visual Studio .NET and .NET Framework • What do you get with WSE? • WS-Addressing • WS-Security • WS-Policy • WS-SecurityPolicy • WS-Trust • WS-SecureConversation • WS-Referral • WS-Attachments • Interoperability

  5. How does WSE work? User Code SoapContext Policy Trace Referral Custom Security Security Token Manager Custom Filters

  6. Problem Statement • Issues with connected systems • Bandwidth and Latency • Domain boundaries • Coordination and Management • Solution • Less transparency • More Explicitness • Implementation • Message-based programming models

  7. Transparency • Transparent programming models are easy • But, they obscure: • Location of code execution • Complete context of execution • You don’t know that you don’t know

  8. Explicitness • Explicit programming models leave more for the developer to do • They do not obscure as much: • Network activity is apparent • Context and timing is known • You know you don’t know so you take precautions • Enables communication to offline services

  9. About Messaging • Several programming models within the "messaging" bucket • Eventing (often called Pub/Sub) • Dialogs • Queues • Request-Response • Key benefits • More natural fit for many business processes • Allows for more asynchronous processing • Many configurations • "Smart" routers • Offline machines • Etc…

  10. Web Services and Messaging • A way of exposing functionality using a set of interoperable protocols • Messages exchanged based on a shared schema • Independent of the programming language used • No shared classes • Unless you intentionally share them

  11. Messaging Implementations • MSMQ • Classic • Offline Queuing • ASMX • Easy to use • WSE V2 • Transport Independence • Host anywhere

  12. MSMQ Messaging • The classic messaging API • MessageQueue class • Two important methods • Send • Receive • Can provide reliable, in order, only once delivery as well as transaction support • Requires MSMQ at both ends of the pipeline

  13. ASMX Messaging • Easiest way to message with SOAP • Create an *.asmx file • Write a class • Decorate methods with [WebMethod] • OneWay or RequestResponse

  14. WSE 2.0 Messaging • WSE 2.0 includes a SOAP-based messaging API • Transport independence • Intra-AppDomain • For testing • Raw TCP • HTTP • Host Independence • Windows application • ASP.NET • Windows Service

  15. WSE 2.0 Messaging • SoapSender and SoapReceiver • One way messages • Deal with the SoapEnvelope rather than method parameters • Must implement method dispatching based on SoapEnvelope.Context.Adressing.Action • No automated reply messages • The Receiver must implement a new Sender • Sender must indicate reply address

  16. Demonstration 1 SoapSender and SoapReceiver

  17. WSE 2.0 Messaging (Continued) • SoapClient and SoapService • One-way and two-way • Uses SoapSender/SoapReceiver • Offers XML Serialization support • Operation-based dispatching • The Action is used to deliver the message to a Method • Automatic replying

  18. Demonstration 2 SoapClient and SoapServer

  19. WSE 2.0 Messaging (Continued) • Channels • Queued model • Raw, explicit programming

  20. Receiving Polling Push Adaptation Adapter Mapper Programming Models • Errors • Dead letter channel • Faults • Gateway • Aggregating Gateway • Router

  21. Programming Models: Receiving • Push-model CLIENT Implicit message receive Message is processed when message arrives Allows for Activation

  22. Demonstration 3 Push-model messaging with ASMX

  23. Programming Models: Receiving • Polling to receive messages CLIENT Explicit message receive Lets recipient control when message is processed

  24. Demonstration 4 Message Polling with WSE 2.0

  25. Programming Models: Adaptation • Application not always messaging aware • Too costly to re-code entire app • Adapters translate app-specific data and behavior into Messages ADAPTER APPLICATION

  26. Programming Models: Adaptation • Message on wire is serialized into common format • Message data on system not always serializable • Message mapper deals with this MAPPER MESSAGE DATA

  27. Programming Models - Errors • Two errors messaging is well-suited to deal with • Dead letters • Invalid messages • Exceptions • Exceptions can occur before dispatch • In user code • Soap Faults map to Exceptions • Fault codes are QNames

  28. APP CODE GATEWAY Design: Gateway • Wraps application-specific logic • Most Web services are gateways

  29. APP CODE GATEWAY Design: Gateway • Aggregator is gateway that combines several messages into one internal action

  30. Design: Router • Routes a message from a source to a destination SOURCE ROUTER DESTINATION

  31. Design: Router • Several type of routers • Splitters ROUTER • Aggregators ROUTER • Filters ABC ROUTER ABZ

  32. ABC ROUTER =DEF A =ABC B Design: Router • And content-based routers

  33. Design: Pub/Sub • Publication and Subscription • Message pattern • One message to subscribe • One to many messages publishing event information • Observer pattern over a distributed system

  34. Design: Pub/Sub • More on pub/sub SUBSCRIBE EVENT SERVICE SUBSCRIBER EVENTS

  35. Design: Pub/Sub • Two models for getting event data • Push – notification includes data • Pull – subscriber sends a request for the subscription data after receiving the event • Push is usually best for Web services • Pull is good when subscribers may not be interested in the data and the data is large or processor intensive

  36. Demonstration 5 Eventing

  37. Design: Reliability • Strongest and most resilient systems implement reliable messaging • Reliable messaging requires: • Idempotent processing • Durable storage NODE NODE

  38. Design: Dialogs and Queues • Dialogs are virtual connections between two nodes • With the help of queues, dialogs can be reliable and persistent across system resets

  39. Design: Dialogs and Queues • More on dialogs and queues NODE NODE

  40. Design: Long-Running Operations • Long-running operations • A key gain of messaging • Allows closer modeling of real-life business scenarios • Examples • User interaction is needed • Batch processing across multiple nodes

  41. Design: Long-Running Operations • Example NODE NODE NODE NODE NODE

  42. Design Guidelines • Avoid RPC and CRUD designs • Tends to encourage RPC like behavior • Interface may imply stateful interactions like enumeration • Interface is likely to be overly chatty • Don’t be too loose or extensible • Focus on encapsulating business processes • Use contracts to reduce coupling

  43. Session Summary • Messaging allows for apps that more closely match business processes • Applications that use messaging are more closely matched with business processes • Existing technology can be used to support messaging • WSE 2.0 provides extensible messaging with web services across multiple protocols

  44. Call to Action • Start designing with messaging in mind • Download WSE 2.0 Service Pack 1 • Download the Hands-On Labs on WSE Messaging from Aaron Skonnard • http://msdn.microsoft.com/webservices/building/wse/default.aspx

  45. For More Information • Blogs • http://benjaminm.net • Rebecca Dias WSE Product Managerhttp://weblogs.asp.net/rdias • Hervey Wilson Lead Developer WSE http://dynamic-cast.com • Newsgroup • microsoft.public.dotnet.framework.webservices.enhancements • Books • Enterprise Integration Patterns – Gregor Hohpe and Bobby Woolf

More Related