Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ws discovery in wcf 4

1,968 views

Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

Ws discovery in wcf 4

  1. 1. WS-Discovery in WCF 4.0<br />By SanketKulkarni<br />
  2. 2. Problem Statement<br />Client of the service needs to know only End Point to consume the service.<br />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.<br />
  3. 3. Solution-End Point Discovery or Dynamic Service.<br />This is a multicast protocol that issues SOAP message over UDP.<br />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. <br />
  4. 4. WS-Discovery conceptual model<br />
  5. 5. WS –Discovery standard or protocol<br />It is a Standard that defines a lightweight discovery mechanism for discovering services based on multicast messages. <br />It enables a service to send a Hello announcement message when it is initialized and a Bye message when is removed from the network.<br />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.<br />Client can find services that have changed endpoint by issuing a Resolve message to which respond with a ResolveMatchmessage.<br />
  6. 6. WCF Service Discovery API<br />This API helps to dynamically publish and discover of web service using WS –Discovery protocol.<br />Modes : There are two modes<br />Managed Mode<br />Ad-Hoc Mode<br />
  7. 7. Managed Mode<br />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. <br />When a new service starts up it sends an announcement message to the discovery proxy.<br />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.<br />If there are matches the discovery proxy sends a ProbeMatchresponse back to the client.<br />The client can then contact the service directly using the service information returned from the proxy.<br />
  8. 8. Ad-Hoc Mode<br />There is no centralized server.<br />Service announcements and client requests are sent in a multicast fashion. <br />Service on start up sends out Hello messages over multicast address using the UDP protocol. <br />Clients have to actively listen for these announcements and process them accordingly.<br />When a client issues a Probe request for a service it is also sent over the network using a multicast protocol.<br />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.<br />
  9. 9. Demo Application<br />Step 1 : Create WCF service<br />
  10. 10. Demo Application<br />Step 2 : Writing Host for the Service.<br />add a new console application<br />Add a reference to ‘System.ServiceModel’ and ‘System.ServiceModel.DIscovery’ in this project.<br />In the project add a new ‘App.Config’ file.<br />
  11. 11. Demo Application<br />‘<serviceDiscovery>’, enables service discovery behavior. This also defines standard ‘udp’ discovery endpoints. The above ‘UDPEndpoint’ configuration makes the service discoverable over a local subnet.<br />
  12. 12. Demo Application<br />Create client application<br />Add a service reference to the WCF service project<br />Add Web.Config file in the project<br />
  13. 13. Demo Application<br />
  14. 14. Demo Application<br />  DiscoveryClient: Allows client application to use available services. This uses udp discovery endpoint name to discover endpoint of the service.<br />  FindCriteria: Represent criteria used for searching services. The criteria can be the service contract made available in the proxy. <br />FindResponse: This contains response from the find service.<br />
  15. 15. Thank You<br />Reference<br />http://msdn.microsoft.com/en-us/library/ee354381.aspx<br />

×