2. Problem Statement Client of the service needs to know only End Point to consume the service. What if binding need to change at the service side from basic to WS over HTTP? This is very basic change but to accommodate this client has to update the service again. And this is very much error prone. It is very tedious task to update client about all the basic frequent change at the service side.
3. Solution-End Point Discovery or Dynamic Service. This is a multicast protocol that issues SOAP message over UDP. This protocol helps for discovering the location endpoints of the service at runtime. The client application uses this protocol to probe the service endpoints and then using this endpoint address, the communication is established with the WCF service.
5. WS –Discovery standard or protocol It is a Standard that defines a lightweight discovery mechanism for discovering services based on multicast messages. It enables a service to send a Hello announcement message when it is initialized and a Bye message when is removed from the network. Client can discover services by multicasting a Probe message to which a service can reply with a ProbeMatch message containing the information necessary to contact the service. Client can find services that have changed endpoint by issuing a Resolve message to which respond with a ResolveMatchmessage.
6. WCF Service Discovery API This API helps to dynamically publish and discover of web service using WS –Discovery protocol. Modes : There are two modes Managed Mode Ad-Hoc Mode
7. Managed Mode In managed mode there is a centralized server called a discovery proxy that services use to publish themselves and clients use to retrieve information about available services. When a new service starts up it sends an announcement message to the discovery proxy. When a clientmust search for a service it sends a Probe request to the discovery proxy and it determines whether any of the services that have been published match the request. If there are matches the discovery proxy sends a ProbeMatchresponse back to the client. The client can then contact the service directly using the service information returned from the proxy.
8. Ad-Hoc Mode There is no centralized server. Service announcements and client requests are sent in a multicast fashion. Service on start up sends out Hello messages over multicast address using the UDP protocol. Clients have to actively listen for these announcements and process them accordingly. When a client issues a Probe request for a service it is also sent over the network using a multicast protocol. Each service that receives the request determines whether it matches the criteria in the Probe request and responds directly to the client with a ProbeMatch message if the service matches the criteria specified in the Probe request.
10. Demo Application Step 2 : Writing Host for the Service. add a new console application Add a reference to ‘System.ServiceModel’ and ‘System.ServiceModel.DIscovery’ in this project. In the project add a new ‘App.Config’ file.
11. Demo Application ‘<serviceDiscovery>’, enables service discovery behavior. This also defines standard ‘udp’ discovery endpoints. The above ‘UDPEndpoint’ configuration makes the service discoverable over a local subnet.
12. Demo Application Create client application Add a service reference to the WCF service project Add Web.Config file in the project
14. Demo Application DiscoveryClient: Allows client application to use available services. This uses udp discovery endpoint name to discover endpoint of the service. FindCriteria: Represent criteria used for searching services. The criteria can be the service contract made available in the proxy. FindResponse: This contains response from the find service.