Navigating the Push Notification Sample Application
Topic Last Modified: 2009-07-23
The push notification sample is comprised of two applications. The first application creates a client Web service that accepts notifications from the server. The second application creates the subscription for the client.
Note
This sample application is intended for instructional purposes only and is not meant to be installed in a production environment.
Push Notification Client Web Service
The client Web service includes the Interfaces.cs and PushNotificationClient.cs files. These files are located in the directory in which the Exchange Server 2007 SDK is installed, in the Samples\PushNotification\PushNotificationClient\ folder.
Interfaces.cs
The Interfaces.cs file contains autogenerated proxy classes and interfaces that were generated by using WSDL.exe. The INotificationServiceBinding interface is the main interface in this file.
Important
Interfaces.cs was created by using WSDL.exe with the /serverInterface option. To generate this file, run WSDL.exe at the command line with the following arguments: wsdl /serverInterface NotificationService.wsdl types.xsd messages.xsd
. NotificationService.wsdl is located in the directory in which the Exchange Server 2007 SDK is installed, in the Libraries\PushNotificationClient\ folder.
PushNotificationClient.cs
The PushNotficationClient.cs file contains the client Web service that implements the INotificationServiceBinding. This file implements the SendNotification method. The SendNotification method receives the notification and sends a response that specifies whether or not to unsubscribe from the notifications.
An event log is created to track any errors in the response message and to track notifications that are sent by the server. The log file is SubscriberEventLog.txt and can be found in the PushNotif folder on the C:\ drive. If an error is logged, the subscription is discontinued.
A timer is established to unsubscribe from the notifications if there have been no new events within three minutes.
Push Notification Subscriber
The push notification sample application that creates the subscription includes the PushNotificationSubscriber.cs file. This file is located in the directory in which the Exchange Server 2007 SDK is installed, in the Samples\PushNotification\PushNotificationSubscriber\ folder.
PushNotificationSubscriber.cs
The PushNotificationSubscriber.cs file contains a single static method called SubscribeForPushNotifications. This application does the following:
- Provides a callback function for handling certificates. This needs to be implemented.
- Establishes the service binding.
- Creates the request.
- Identifies the events for which the client subscribes.
- Identifies the frequency, in minutes, which the computer on which the Client Access server role is installed will send notifications.
- Identifies the location of the client Web service that receives the notifications.
- Sends the request with the subscription information and receives the response with the subscription identifier.
- Creates a MailboxEventLog request and response XML files to track the communication between the server and client.