1

I have a requirement my below,

We have a build release server environment, which has currently linked with the Teamcity Build system and Kb system, etc. That means, in Teamcity, every build event changes (i.e., events like, build started, build finished, build succeed, build failed, build quality changes/pinned, etc.), it notifies/calls the release system web service with build details (the Xml data).

Now, we are trying to move to the TFS 2013 system instead of Teamcity and I am new to the TFS administration things. I have got a task to connect the release server and do the same job like Teamcity. Which means, in TFS system, on every build event changes (like, build started, build finished, build succeed, build failed, build quality changes, etc.), it should call the release system web service with TFS build Xml data so that I can update that in our database. Would you please tell me the method by which I can achieve that?

FYI, I have tried with TFS alert notification as below. But, seems like it doesn’t allow to call web service from this section. It only allows to mail the details to specific users. Please let me know if I am wrong.

If it can be achievable through XMAL script, would you please provide some test XAML scripts how can I call the web service from this?

Thanks.

Dhanuka
  • 2,826
  • 5
  • 27
  • 38

1 Answers1

1

There are multiple ways to achieve this. But if the alert types are sufficient for your needs, then going through the alert mechanism is the simple way.

You will just need to create a simple listener service to be notified of the desired event (you already suspected of a such mechanism) using alert mechanism's SOAP event feature.

Create a simple web service, having a method like below:

public void Notify(string eventXml, string tfsIdentityXml, SubscriptionInfo subscriptionInfo)
{
    EventProcessor.Process(eventXml);
}

SubscriptionInfo class is defined in Microsoft.TeamFoundation.Framework.Server, but you can also use the override without it if available.

Then publish and make available this service, for example having the address: http://localhost:101/NotifyCorpService.svc

Then, you should add an alert for each event you want to be notified (or a single one if applicable using conditions together):

Finally, you can use the "eventXml" and using its contents, call the web service you want in the code behind of the simple web service we created (NotifyCorpService in our example)

Beytan Kurt
  • 2,203
  • 4
  • 34
  • 57
  • Hello Beytan, Thank you for the reply. As per you, I have created WCF service. But while I open that WCFTestClient it shows an error like "Error: Cannot obtain Metadata from /TfsNotifyService.svc". Please let me know if I missed anything. Regards, Biswa – Biswa Ranjan Das Jun 09 '15 at 09:49
  • @BiswaRanjanDas it doesn't have to be a wcf service, it can be a simple asmx also. But since you've created a wcf service, it should be tested with wcfTestClient. Probably you have misconfigured endpoints or bindings. Please get help with "Cannot obtain Metadata wcftestclient" on google search, forexample [this](http://stackoverflow.com/questions/9114870/wcf-test-client-cannot-add-service-cannot-obtain-metadata) and [this](http://stackoverflow.com/questions/17070677/error-cannot-obtain-metadata-using-wcf-test-client-c-and-trying-to-implemen) links on SO can help. – Beytan Kurt Jun 09 '15 at 10:57
  • Thanks Beytan. I have configured the same way what I found in google search. might be some other issue. I have created an asmx file with "public void Notify(string eventXml, string tfsIdentityXml)" and called http://localhost/ReleaseSvr/TfsEventsNotifications.asmx on every build status change, but seems like it is not working. To achieve this with simple asmx file, Would you please send me some sample asmx code to biswadas2@hotmail.com address? – Biswa Ranjan Das Jun 10 '15 at 07:33
  • At SO, we all want everyone who comes to the question, gets the answer he was looking for so it would be not nice to share the answer through email. However, you can create another question with the problem you're facing with the web service method. I'll also try to edit my answer to provide more information on the details. – Beytan Kurt Jun 12 '15 at 05:51