none
How to create client WCF service that receive notification from Exchange 2010 RRS feed

  • Question

  • Hi,

    Requirement : Need to create 2 wcf services.

       - One for subscription to exchange 2010 for new mail event happens in an public folder.

       - Client Wcf service that receives an notification and get called automatically when an new mail reached the public folder.

    Question: while subscribing to exchange for new mail event i am writting below code in one function of WCF service.

    ISubscribe Service

    [ServiceContract]

        public interface ISubscribe

        {

            [OperationContract]

            Void SubscribeUser ();

        }

    Subscribe Service

    Public void SubscribeUser()

    {

    // Create connection to oracle server and get subscription Id .

    //set watermark to Subscription if available. Else watermark=null.

     ExchangeService service = new ExchangeService();

    service.Credentials = new NetworkCredential("username", "password", "domain");

    service.Url = new Uri("Webservice link ");

    PushSubscription pushSubscription = service.SubscribeToPushNotifications(

    new FolderId[] { WellKnownFolderName.Inbox },

    new Uri("https://...")                  /* Client webservice link which will be called from exchange */,

    5                                                                 /* Get a status event every 5 minutes if no new events are available. */,

    null                                                 /* watermark: null to start a new subscription. */,

    EventType.NewMail);

    }          

    Question 1 : in code

    PushSubscription pushSubscription = service.SubscribeToPushNotifications(

    new FolderId[] { WellKnownFolderName.Inbox },

    new Uri("https://...")                  /* Client webservice link which will be called from exchange */,

    5                                                                 /* Get a status event every 5 minutes if no new events are available. */,

    null                                                 /* watermark: null to start a new subscription. */,

    EventType.NewMail);

    }   

    I understand that Uri in above code is the Client Wcf service that get called on notification. Do i need to give the function name inside the Wcf service which is going to process Exchange service response?. if not how does system know which function to call in client Wcf service?

    Question 2: How to catch the response in client Wcf service function?. I need to update DB as per the response i get from exchange server. so i need to catch the response.

    Please drop me an reference code if possible. so that i can understand better.

    Regards,

    Veenaa

    Monday, August 26, 2013 9:55 AM