120 likes | 345 Views
RBA Consulting. WCF 4.0: Routing & Discovery Services January 20, 2011. WCF Routing.
E N D
RBA Consulting WCF 4.0: Routing & Discovery Services January 20, 2011
WCF Routing • The Routing Service is a generic SOAP intermediary that acts as a message router. The core functionality of the Routing Service is the ability to route messages based on message content, which allows a message to be forwarded to a client endpoint based on a value within the message itself, in either the header or the message body. • from MSDN
Routing Service Usage • Protocol Bridging • Content-Based Routing • Failover (Backup Lists)
Using the Routing Service • Create regular WCF Services to be called by the Routing Service. • Create a Routing Service: • Change the markup in the .svc file to point to the routing Service. Be sure to reference System.ServiceModel.Routing in your project • In the web.config: • Add endpoints for all the services to which you’ll connect in the <client> section.
Using the Routing Service (cont’d) • In the web.config (cont’d): • Create a namespace filter and set the Xpath filterData • Add filterTables to point to the correct end points • Set the Routing behavior to identify the filterTables
WCF Discovery • The Discovery APIs provide a unified programming model for the dynamic publication and discovery of Web services using the WS-Discovery protocol. These APIs allow services to publish themselves and clients to find published services. • MSDN
How Discovery Works • Discovery involves a client, a service, and/or a Discovery Proxy • A Client is an entity that is looking for services and utilizes the “DiscoveryClient” to search for them. • A Service is a WCF service that has endpoints which can be discovered. A Service adds a ServiceDiscoveryBehavior in the service host description, which enables it to respond to find requests from clients. A service may also host an announcement client if it wants to announce itself. • A Discovery Proxy is a centralized repository that knows about services. It is not required. • Find/Resolve • A client can find a service based on criteria such as the service type. It can send out a Probe message to which the recipient of the probe, either a service or a proxy, responds back to the client with the appropriate service metadata. • A resolve can be used to find a service based on its endpoint address. • Announcements • Services can announce themselves to the network and clients can be configured to listen for such announcements
References • MSDN. What’s New in WCF 4.0. Visual Studio 2010 Training Kit. • MSDN. WCF Discovery. http://msdn.microsoft.com/en-us/library/dd456782.aspx • Ambar Ray. Content Based Routing Using WCF 4. http://www.codeproject.com/KB/WCF/WCF_4.aspx • Anurag P. Discovery Concepts. http://blogs.msdn.com/b/discovery/archive/2009/05/29/discovery-overview.aspx • Richard Seroter. Simpler Way of Hosting the WCF 4.0 Routing Service in IIS7http://seroter.wordpress.com/2010/03/09/simpler-way-of-hosting-the-wcf-4-0-routing-service-in-iis7/