apacay
apacay

Reputation: 1712

How to connect To TFS EventService with SOAP in easy steps

I can't seem to find how to connect to the TFS EventService SOAP, I think I should make a service which gets called by TFS with stuff as parameters with which I can work with...

But I'm not finding anything like that on the internet.

The only thing I've found is this: http://msdn.microsoft.com/en-us/magazine/cc507647.aspx Which seems old and deprecated.

I'm using tfs2012 and vs2012.

@Edit: The idea is to hook up to the WorkItemStatusChange and to the CheckIn events.

Upvotes: 0

Views: 921

Answers (1)

MikeR
MikeR

Reputation: 3075

I use an interface for my services (same for TFS2010 and TFS2012)

using System.ServiceModel;
using System.ServiceModel.Web;

namespace TFS_Event_Services
{
[ServiceContract(Namespace = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03")]
 public interface ITFS_Event_Services
 {

    [OperationContract(Action = "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03/Notify")]
    [XmlSerializerFormat(Style = OperationFormatStyle.Document)]
    [WebInvoke(Method="Notify")]
    void Notify(string eventXml, string tfsIdentityXml);

 }
}

So my .svc looks like this:

namespace TFS_Event_Services
{
 public class TFS_Event_Services_2012 : ITFS_Event_Services
 {
    public void Notify(string eventXml, string tfsIdentityXml)
    {
      //do something with the Event
    }        
 }
}

The .svc markup:

<%@ ServiceHost Language="C#" Debug="true" Service="TFS_Event_Services.TFS_Event_Services_2012" CodeBehind="TFS_Event_Services_2012.svc.cs" %>

After creating your web service you need to publish it on some IIS which is the target of TFS alert soap call, of course.

Upvotes: 2

Related Questions