IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

EDI/Outils Discussion :

Team Foundation Server et notifications "vides"


Sujet :

EDI/Outils

  1. #1
    Membre à l'essai
    Inscrit en
    Novembre 2005
    Messages
    24
    Détails du profil
    Informations forums :
    Inscription : Novembre 2005
    Messages : 24
    Points : 16
    Points
    16
    Par défaut Team Foundation Server et notifications "vides"
    Bonjour à tous.
    Je me bats depuis quelques jours pour abonner mon WebService aux notifications de TFS.
    J'ai créé un WebService en C# qui expose la fonction
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    public void Notify(string eventXml, string tfsIdentityXml, SubscriptionInfo SubscriptionInfo)
    . La seule chose que fait ce WS est de recopier les arguments de Notify (eventXML, tfsIdentityXML et SubscriptionInfo) dans un fichier texte.
    J'ai donc inscrit ce webservice à la notification "WorkItemChanged" de TFS avec l'utilitaire Bissubscribe.exe fourni avec TFS.

    Le problème se produit quand, en tant qu'utilisateur de Visual Studio Team System sur un autre poste, je modifie l'état d'un WorkItem en faisant par exemple passer le champ "status" de "Ouvert" à "Fermé": mon webservice est bien notifié de ce changement mais les champs eventXML et SubscriptionInfo sont nuls !!
    Voilà. je reçois bien la notification mais je ne peux rien en faire...
    Si vous avez des pistes !!

    Le WebService:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.IO;//pour FileStream, utilisé pour les tests, à supprimer après
    using System.Text;//pour Encoding, idem
    using System.Web;
    using System.Web.Services;
    using System.Web.Services.Protocols; // pour SoapDocumentMethod
    using System.Xml;
    using System.Xml.Serialization;
    using Microsoft.TeamFoundation.Server;
    using System.Windows.Forms;// <--- pour messageBox
     
     
    namespace monWebService
    {
        public abstract class EndPointBase : WebService
        {
     
            protected T CreateInstance<T>(string serializedType) where T : new() // T doit disposer d'un constructeur sans paramètre
            {
                XmlDocument doc = new XmlDocument();//représente un document XML
                doc.LoadXml(serializedType);//charge le document à partir de la chaîne 
                return (T)new XmlSerializer(typeof(T)).Deserialize(new XmlNodeReader(doc));//recrée l'objet de type T 
            }
     
            public abstract void Notify(string eventXML,
                                        string tfsIdentityXml,
                                        SubscriptionInfo subscriptionInfo);
        }
     
        [WebService(Namespace = "http://localhost/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        public class WorkItemChangedEndPoint : EndPointBase
        {
     
            [WebMethod]
            [SoapDocumentMethod("http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03/Notify",
                                RequestNamespace =
                                "http://schemas.microsoft.com/TeamFoundation/2005/06/Services/Notification/03")]
            public override void Notify(string eventXML, string tfsIdentityXml, SubscriptionInfo subscriptionInfo)
            {
     
                FileStream stream = File.Create(@"D:\webservice\monWebService\log1.txt");
                if (stream.CanWrite)
                {
                    StreamWriter monWriter = new StreamWriter(stream);
                    monWriter.AutoFlush = true;
     
                    monWriter.WriteLine("autorisation d'écriture : OK");                
     
                    if (eventXML == null)
                    {
                        monWriter.WriteLine("eventXML == null");
                    }
                    else
                    {
                        monWriter.WriteLine("eventXML: " + eventXML);
                    }
     
                    if (tfsIdentityXml == null)
                    {
                        monWriter.WriteLine("tfsIdentityXml == null");
                    }
                    else
                    {
                        monWriter.WriteLine("tfsIdentityXml: " + tfsIdentityXml);
                    }
     
                    if (subscriptionInfo == null)
                    {
                        monWriter.WriteLine("subscriptionInfo == null");
                    }
                    else
                    {
                        monWriter.WriteLine("subscriptionInfo: ");
     
                        if (subscriptionInfo.Classification != null)
                        {
                            monWriter.WriteLine("classification: " + subscriptionInfo.Classification);
                        } 
                        if (subscriptionInfo.Subscriber != null)
                        {
                            monWriter.WriteLine("Suscriber: " + subscriptionInfo.Subscriber);
                        }
     
                        monWriter.WriteLine("ID: " + subscriptionInfo.ID.ToString());
     
                    }
                    monWriter.Close();
                }
            }
     
            [WebMethod]
            public string WriteHello()
            {             
                return "Hello";
            }
        }
     
    }

  2. #2
    Membre habitué
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    266
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 266
    Points : 135
    Points
    135
    Par défaut
    Bonjour

    Ton code me semble bon. De quelle manière as tu abonné ton WS ?

  3. #3
    Membre à l'essai
    Inscrit en
    Novembre 2005
    Messages
    24
    Détails du profil
    Informations forums :
    Inscription : Novembre 2005
    Messages : 24
    Points : 16
    Points
    16
    Par défaut
    Salut.
    J'utilise Bissusbcribe.exe avec la ligne de commande suivante:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Bissubscribe.exe /eventType WorkItemChangedEvent /deliveryType Soap /server http://localhost:8080 /address http://localhost:81/monWebService/theService.asmx

  4. #4
    Membre à l'essai
    Inscrit en
    Novembre 2005
    Messages
    24
    Détails du profil
    Informations forums :
    Inscription : Novembre 2005
    Messages : 24
    Points : 16
    Points
    16
    Par défaut
    Bon, j'aurais pas dû m'énerver...
    le 1er argument de Notify doit être:
    et non:
    la casse...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Team Foundation Server] Comment ajouter des Items ?
    Par Dadou74 dans le forum EDI/Outils
    Réponses: 1
    Dernier message: 27/07/2006, 15h36
  2. [IDE][Team Foundation Server]Comment forcer MAJ SQL Reports?
    Par Misdrhaal dans le forum Contribuez
    Réponses: 4
    Dernier message: 25/01/2006, 11h41
  3. [Team Foundation Server] Comment créer un build ?
    Par Misdrhaal dans le forum Contribuez
    Réponses: 1
    Dernier message: 17/01/2006, 12h40

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo