EventSynchronizationService
The EventSynchronizationService WCF service is a subscription service which enables clients (e.g. the Smartsite Developer Console / Smartsite Studio) to receive notifications from the Smartsite iXperion publication engine whenever e.g. an item has been changed. Since clients must subscribe first before receiving notification events, this service is often also referred to as EventSubscriptionService.
The EventSynchronizationService implements a so-called duplex service contract, which allows both service and client(s) to send and receive messages. A duplex contract is defined as a pair of interfaces - a primary interface from the client to the service and a callback interface from the service to the client.
First, the Smartsite.Core.Services.IEventSubscriptionContract interface defines two methods, Subscribe and Unsubscribe, and acts as the primary interface (the class providing the Event Synchronization service implements this particular interface and the contract attribute of the endpoint element within the web.config refers to this interface). A client must always first call the Subscribe method to begin receiving notification messages (and Unsubscribe to stop receiving messages).
Second, the Smartsite.Core.Services.IEventSynchronizationContract interface defines the callback contract, providing methods used by the service to notify connected clients of occurring events.
Ultimately, it's the Smartsite.Core.Services.EventSynchronizationService class offering the Event Synchronization/Subscription service. It implements the aforementioned IEventSubscriptionContract interface and uses the IEventSynchronizationContract to execute the callback operations.
WSDualHttpBinding
Duplex communication can only occur when a client establishes a session with a service and gives the service a channel on which the service can send messages back to the client. Therefore, the configuration for the Event Synchronization service (within the web.config) must provide a binding that supports both session communication and duplex communication: wsDualHttpBinding.
This binding requires that the client has a public URI that provides a callback endpoint for the service. By default the Smartsite Developers Console uses the local machine's hostname and port number 8177 to construct a callback endpoint address.
Configuration
The configuration for the EventSynchronizationService is, besides it should be registered within the services section within the smartsite.config file, limited to just a few sections within the system.serviceModel node of the web.config configuration file.
First of all there should be a service node for the EventSynchronizationService, which specifies the endpoint address, the binding and the contract. As for the service on the server itself, this is the only configuration needed.
However, since the Smartsite Developers Console uses the same web.config, the client configuarion for this particular service must be included within the system.serviceModel section as well. This includes a client section and (usually) a binding specification, as shown below.
The example below shows the system.serviceModel section of a web.config file with just the necessary nodes for the EventSynchronizationService (both client and server configuration sections).
XML | Copy Code |
---|---|
<system.serviceModel> <services> <service name="Smartsite.Core.Services.EventSynchronizationService"> <endpoint address="http://machinename/sitename/EventSynchronizationService" binding="wsDualHttpBinding" name="dualHttpBinding" bindingNamespace="http://Smartsite.Webservices.EventSubscriptionService" contract="Smartsite.Core.Services.IEventSubscriptionContract" /> </service> </services> <bindings> <wsDualHttpBinding> <binding name="WSDualHttpBinding_EventSubscriptionService"> <readerQuotas maxStringContentLength="16384" /> <reliableSession ordered="true" inactivityTimeout="00:02:00" /> <security mode="Message"> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsDualHttpBinding> </bindings> <client> <endpoint address="http://machinename/sitename/EventSynchronizationService" binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_EventSubscriptionService" contract="Smartsite.Core.EventSynchronizationClient.EventSubscriptionService" name="WSDualHttpBinding_EventSubscriptionService"> <identity> <userPrincipalName value="[Domain\]System Administrator account" /> </identity> </endpoint> </client> </system.serviceModel> |