Subscribing with Web Service do TFS Events

Hello,

I am trying to subscribe to some TFS Events (CheckinEvent, WorkItemChangedEvent, ProjectCreatedEvent). I am doing it using code:

TfsEventService.Event tfsEvent = new TfsEventService.Event();

TfsEventService.DeliveryPreference preferences = new TfsEventService.DeliveryPreference();

preferences.Type = TfsEventService.DeliveryType.Soap;

preferences.Schedule = TfsEventService.DeliverySchedule.Immediate;

preferences.Address = "http://localhost:2023/TFS Subscription WS/Service.asmx";

tfsEvent.SubscribeEvent("S-1-5-21-2033024631-3213772562-2269560735-500", "ProjectCreatedEvent", "", preferences);

where:

S-1-5-21-2033024631-3213772562-2269560735-500 - is a user SID (I have tried SIDs for my account and TFS Service account)

TfsEventService - is a reference to TFS Event Web Service

http://localhost:2023/TFS Subscription WS/Service.asmx - is URL to my Web Service which should be notified when subscribed event occurs on TFS.

My Web Service has one method:

[SoapDocumentMethod(Action = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/02/Notify", RequestNamespace = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/02")]

[WebMethod]

public void Notify(string eventXml, string tfsIdentityXml)

{

using (TextWriter stream = new StreamWriter("c:\\log4.txt", true))

{

stream.WriteLine("DATE: " + DateTime.Now.ToString());

stream.WriteLine("EVENT XML:");

stream.WriteLine(eventXml);

stream.WriteLine();

stream.WriteLine("TFS IDENTITY XML:");

stream.WriteLine(tfsIdentityXml);

stream.WriteLine();

stream.WriteLine("=======================================================");

stream.WriteLine();

}

}

Unfortunately, my Web Service is not notified when I create new project on TFS. What am I doing wrong Could it be lack of Filter Expression I SubscribeEvent Method Call (I have passed there: “”) If yes – how to write in VSEFL that there is no filter and I am interested in all events

And… I have checked subscriptions for user with SID S-1-5-21-2033024631-3213772562-2269560735-500 using TFS Event Web Service using EventSubscriptions method – new subscriptions have been created. SID S-1-5-21-2033024631-3213772562-2269560735-500 is my account SID – I ma using this account to all jobs in TFS (including creating new projects).




Answer this question

Subscribing with Web Service do TFS Events

  • errolian

    Check in the TFSIntegration database, in the tbl_subscription table. See if your webservice has an entry there (the address field should have it). If it doesn't use bissubscribe command line tool to do so. If it does have an entry check the event log on the application server to see if there are any errors that it is recording. You shouldn't need a filter expression in order for this to work.

  • nikki UK

    What version of TFS you are using If it is post RC, the namespace should change as described in http://blogs.msdn.com/psheill/archive/2006/02/28/540945.aspx

    You can set right trace flags to see additional info on event processing as given in http://blogs.msdn.com/psheill/archive/2005/11/28/497662.aspx . This can help in debugging the events.



  • Subscribing with Web Service do TFS Events