Dot Net Solutions
George V Place,
4 Thames Avenue
Windsor
Berkshire
SL4 1QP
Great Britain
0845 402 1752
GEO: -0.606174, 51.4843
 
 
 
 

Continuous Integration with Team Foundation Server and WCF 

Tags: WCF

Khushboo Sharan at Microsoft has made a very basic sample for enabling continuous integration (more) with Team Foundation Server available here

The sample uses a standard .Net 2 .asmx webservice to listen to CheckIn Events from the server, with the service defined as follows:

[WebService(Namespace = "http://schemas.microsoft.com/Team[...]
Foundation/2005/06/Services/Notification/03")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class NotificationService : System.Web.Services.WebService
{

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

[WebMethod]
public void Notify(string eventXml, string tfsIdentityXml)
// Do not change the names of these parameters

{

This works great with a webservice, but what about if you want to subscribe to the CheckIn event from a WCF host? Using the method signature defined above in your OperationContract silently fails.

After examining the XML received from the service, it was found that an extra element was being sent from the server. This means that the correct signature for receiving the CheckIn event within a WCF service is as follows:

[ServiceContract(Namespace = "http://schemas.microsoft.com[...]
/TeamFoundation/2005/06/Services/Notification/03"
)]
public interface ICheckInEvent
{
[ OperationContract(Action = "http://schemas.microsoft.com/[...]
TeamFoundation/2005/06/Services/Notification/03/Notify"
, Name = "Notify")]
void Notify(string eventXml, string tfsIdentityXml, SubscriptionInfo SubscriptionInfo);
}

Where SubscriptionInfo is a DataContract defined like this:

[DataContract(Namespace="http://schemas.microsoft.com/[...]
TeamFoundation/2005/06/Services/Notification/03"
)]

public class SubscriptionInfo

{

[DataMember()]
public string ID;

[DataMember()]
public string Subscriber;

[DataMember()]
public string Classification;
}

Finally we can use a WCF service to integrate with TFS!

Published: 18 Jan 2007  11:57
0  Comments  |  Trackback Url  | 0  Links to this post | Bookmark this post with:        

Links to this post

No linkbacks added

Comments

No comments added yet

 
 
 
 

Post comment

Name *:
URL:
Email:
Comments:


CAPTCHA Image Validation


 
 
 
 

Related posts

- Hosting WCF service in IIS - Published: 26 Jan 2007