MS Windows Communication Foundation (WCF) 4.0 has lot of new features one of the feature called WS-Discovery. The goal of WS-Discovery protocol is to enable client to search one or more Targeted Services. WS-Discovery protocol is a multicast discovery protocol. The main usage of this protocol is, its helps client needs to find the services on the network. Here services can be SOA services or any other hardware device. For example Windows Vista implements WS-Discovery to support the Device Profile for Web Services (DPWS). DPWS provides standards-based connectivity to network devices including printers, RFID readers, wireless cameras, projectors, and more.
Here is the URL where you can download WS-Dynamic Discovery White paper http://specs.xmlsoap.org/ws/2005/04/discovery/ws-discovery.pdf
Here is the Model for the message exchanges between a Target Service and a Client ( please download the above white paper and read that helps lot easier to understand WS-Discovery )
WS-Discovery protocol defines two modes of operations one is Ad hoc mode and Managed mode. In ad hoc mode, clients probe for services by sending multicast messages. Services that match the probe respond directly to the client. In order to minimize the need for client polling, services can also "announce" when joining or leaving the network by sending a multicast message to any clients who may be "listening". Although ad hoc discovery is the simplest form, it only works within the context of a local subnet.
Now let see how we can enable WCF service for Discovery in WCF 4.0 and .NET 4.0 ( Note: Here i am using .NET & WCF 4.0 Beta 1).
Enabling WCF 4.0 Service for WS-Discovery is very easy. we need to modify WCF service configuration settings .
1) First add one endpoint to the service
2) Add Service behavior with serviceDiscovery element.
By doing the above changes into WCF service configuration , the WCF service will become discoverable over UDP on the local subnet. Clients can now takes an advantage of WS-Discovery at runtime to “Discover” the actual address of the running service. WCF 4.0 in .NET 4 makes it easy for clients to accomplish this through a new DiscoveryClient class which lives in System.ServiceModel.Discovery assembly.
Here is the client code and Configuration File
In this blog post i showed that the client simply probed services for based on client contract type. Next post we will see how we can use Service Announcements
stay tuned…..
Thanks(Nandri)
SreenivasaRagavan.
3 comments:
Hi,
Nice post that shows how simple it is.
Do you have any experience with accessing a WCF host from a DPWS client? I can't get it to work and there almost no examples, yet.
Roel
hi,
nice post,
can u please tell if it will work on cross subnets as well
gbwhatsapp
gbwhatsapp apk
gbwhatsapp download
gbwhatsapp for android
gbwhatsapp for ios
gbwhatsapp iphone
the article that you created is very useful, hopefully thank you also visit my blog.
Post a Comment