none
Best way of getting data from TFS, WCF?

    Question

  • If we wanted to get data out of the system what would be the best method for WCF and TFS 2012 and why?

    Thanks in advance,

    Jonathan

    Wednesday, July 24, 2013 6:32 PM

Answers

  • Hi Jonathan,

    What would be your reason not to use the Client Object Model? The Client Object Model communicates with TFS also, using some form of web service calls, only you don't have to think about it. 

    If you are looking to connect to TFS from say a mobile device I'd understand you cant use the Client Object Model directly but then I guess I'd still host a "facade" web service myself which retrieves data from TFS using the Client Object Model and exposes it as a web service your device can connect to.

    I'm not sure how well documented the TFS web services are as they aren't made for you to connect to them directly using a SOAP or WCF client. These web services can and will change when updates of TFS are installed.

    There is something called TFS OData services (see http://www.microsoft.com/en-us/download/details.aspx?id=36230) maybe that's an option, but even that uses the Client Object Model:

    "The Team Foundation Server OData API is an implementation of the OData protocol built upon the existing Team Foundation Server client objet model used to connect to Team Foundation Server." 

    Thursday, July 25, 2013 6:18 PM
  • Hi Jonathan,

    As far as I know TFS does not have a (well documented) endpoints. The only thing WCF related TFS service I could find was the TFS Event Service (http://www.ewaldhofman.nl/post/2010/08/02/How-to-use-WCF-to-subscribe-to-the-TFS-2010-Event-Service-rolling-up-hours.aspx).

    TFS does use WCF or ASMX services but these aren't (publicly) documented. You can find them by browsing to "C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\Web Services\TeamFoundation\Administration\" and "C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\Web Services\_tfs_resources\" thats where the .ASMX files are stored that the Team Foudation Server/tfs web application hosts (in IIS).

    You can also browse to the services to view the operations by pasting the relative location behing your TFS URL, like this:
    "http://localhost:8080/tfs/_tfs_resources/TestManagement/v2.0/TestManagementWebService.asmx"

    You can also get the WSDL file by using:
    "http://localhost:8080/tfs/_tfs_resources/TestManagement/v2.0/TestManagementWebService.asmx?WSDL"

    Using this you should be able to connect to them using the "Add service reference" option in visual studio.

    But as you see you'll have to do a lot of digging around to find them. I suspect the Client Object Model uses these services also (I wouldn't know of any other way for it to connect to TFS) so if you are looking for an API that uses these services to connect to TFS, I'd say the Client Object Model is your best bet.


    Friday, July 26, 2013 5:42 AM

All replies

  • Hi Jonathan,

    I'm not sure whether I understand your question, do you want to retrieve data from TFS using WCF or do you want to build a WCF application that can read data from TFS and pass this through or something like that?

    Anyway if you want to connect to TFS "from code" I'd advise you to use the Team Foundation Server Client Object Model. Where the Web Services TFS that TFS hosts might change significantly between two versions of TFS the Client Object Model will remain compatible. Furthermore the Client Object Model is quite well document and quite easy to use.

    Wednesday, July 24, 2013 8:14 PM
  • Hi Sander,

    Thank you for your response!

    I'm looking to retrieve data from TFS using WCF.

    Thanks,
    Jonathan

    Thursday, July 25, 2013 4:36 PM
  • Hi Jonathan,

    What would be your reason not to use the Client Object Model? The Client Object Model communicates with TFS also, using some form of web service calls, only you don't have to think about it. 

    If you are looking to connect to TFS from say a mobile device I'd understand you cant use the Client Object Model directly but then I guess I'd still host a "facade" web service myself which retrieves data from TFS using the Client Object Model and exposes it as a web service your device can connect to.

    I'm not sure how well documented the TFS web services are as they aren't made for you to connect to them directly using a SOAP or WCF client. These web services can and will change when updates of TFS are installed.

    There is something called TFS OData services (see http://www.microsoft.com/en-us/download/details.aspx?id=36230) maybe that's an option, but even that uses the Client Object Model:

    "The Team Foundation Server OData API is an implementation of the OData protocol built upon the existing Team Foundation Server client objet model used to connect to Team Foundation Server." 

    Thursday, July 25, 2013 6:18 PM
  • Thank you again Sander. 2 last questions please.

    Does TFS have a WCF endpoint? and if so is it in any SDK?



    Thursday, July 25, 2013 6:24 PM
  • Hi Jonathan,

    As far as I know TFS does not have a (well documented) endpoints. The only thing WCF related TFS service I could find was the TFS Event Service (http://www.ewaldhofman.nl/post/2010/08/02/How-to-use-WCF-to-subscribe-to-the-TFS-2010-Event-Service-rolling-up-hours.aspx).

    TFS does use WCF or ASMX services but these aren't (publicly) documented. You can find them by browsing to "C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\Web Services\TeamFoundation\Administration\" and "C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\Web Services\_tfs_resources\" thats where the .ASMX files are stored that the Team Foudation Server/tfs web application hosts (in IIS).

    You can also browse to the services to view the operations by pasting the relative location behing your TFS URL, like this:
    "http://localhost:8080/tfs/_tfs_resources/TestManagement/v2.0/TestManagementWebService.asmx"

    You can also get the WSDL file by using:
    "http://localhost:8080/tfs/_tfs_resources/TestManagement/v2.0/TestManagementWebService.asmx?WSDL"

    Using this you should be able to connect to them using the "Add service reference" option in visual studio.

    But as you see you'll have to do a lot of digging around to find them. I suspect the Client Object Model uses these services also (I wouldn't know of any other way for it to connect to TFS) so if you are looking for an API that uses these services to connect to TFS, I'd say the Client Object Model is your best bet.


    Friday, July 26, 2013 5:42 AM