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

Windows Workflow Foundation .NET Discussion :

CallExternalMethod n'appèlle jamais sa méthode.


Sujet :

Windows Workflow Foundation .NET

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    67
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 67
    Points : 63
    Points
    63
    Par défaut CallExternalMethod n'appèlle jamais sa méthode.
    Bonjour tout le monde,

    J'ai un petit problème avec CallExternalActivity, celui-ci n'appèlle jamais sa fonction a appeller, il ne fait pas non plus son code invoking car juste avant il passe dans le handlerFault avec l'erreur suivante :
    "Could not find service of type 'AnAssembly.IExecuteExternalCode' through the currently configured services. Consider adding the service to ExternalDataExchangeService."

    Pourtant juste avant, ainsi que juste après je vérifie que ma classe ExecuteExternalCode se trouve bien dans les service de mon Runtime.

    grâce aau code suivant.(et il fonctionne).
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    WorkflowRuntimeManager a = new WorkflowRuntimeManager();
     
    IExecuteExternalCode b = (IExecuteExternalCode)(a.Runtime.GetService<ExternalDataExchangeService>().GetService(typeof(AnAssembly.ExecuteExternalCode)));
     
    b.execute(10, new AutomationQuery());
    vous pouvez voir le design de mon Workflow ici :

    http://lh3.ggpht.com/TKanos/SH9qIZqq...JPG?imgmax=576

    J'instancie mon Runtime ainsi :
    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
     
    public WorkflowRuntime Runtime
     
    {
     
        get
        {
     
              if (_workflowRuntime == null)
              {
                  ExternalDataExchangeService edes = new ExternalDataExchangeService(); 
     
                  messagingService.ResultReceived += new EventHandler<WorkflowRuntimeMessagingService.MessageResultEventArgs>(OnMessageResultReceived);
     
                  _workflowRuntime = new WorkflowRuntime("WorkflowRuntime");
     
                 _workflowRuntime.AddService(edes);
                 edes.AddService(new AnAssembly.ExecuteExternalCode());
                 _workflowRuntime.StartRuntime();
     
              this.AddWorkflowRuntimeAssembly(Assembly.GetExecutingAssembly());
     
           }
     
        return _workflowRuntime;
     
      } 
     
    }
    Dans un autre fonction j'instancie le ManualWorkflowSchedulerService.

    Mon Interface :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
    [ExternalDataExchange]
    [CorrelationParameter("id")]
    public interface IExecuteExternalCode
    {
     
    [CorrelationAlias("id", "e.Id")]
    event EventHandler<ExecuteExternalCodeEventArgs> ExternalCodeExtecutedComplete;
     
    [CorrelationInitializer]
    void Execute(string id, AutomationQuery request);
     
    }
    Mon Code :

    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
     
    public class ExecuteExternalCode : IExecuteExternalCode
    {
     
    #region IExecuteExternalCode Members
     
    public event EventHandler<ExecuteExternalCodeEventArgs> ExternalCodeExtecutedComplete;
     
    public void Execute(string id, AutomationQuery request)
    {
     
         // I NEVER ENTER IN THIS FUNCTION
     
         ThreadPool.QueueUserWorkItem(Execute, new    ExecuteArgs(WorkflowEnvironment.WorkflowInstanceId, id, request));
     
    }
     
    #endregion
     
    private void Execute(object state)
     
    {
     
    }
     
     
     
    //.....
     
    }
    Quand j'execute le WF, j'arrive dans le Replicator qui appelle l'evenement
    Replicator_ChildInitialized et juste après au lieu de rentrer dans le CallExternalMethod StartRun, il fait une erreur et va dans HandlerFault.


    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
     
    private void StartRun_MethodInvoking(object sender, EventArgs e)
    {
         Console.WriteLine("NEVER the second");
    }
     
    private void Replicator_ChildInitialized(object sender, ReplicatorChildEventArgs e)
    {
       Console.WriteLine("First");
    }
     
    #endregion
     
    protected override ActivityExecutionStatus HandleFault(ActivityExecutionContext executionContext, Exception exception)
    {
       Console.WriteLine("Second");
     
    /////////////////////////////////////////////////////////////////
     
    // I Do this code to see if my class are in the Runtime
     
    WorkflowRuntimeManager a = new WorkflowRuntimeManager();
     
    IExecuteExternalCode b = (IExecuteExternalCode)(a.Runtime.GetService<ExternalDataExchangeService>().GetService(typeof(AnAssembly.ExecuteExternalCode)));
     
    b.execute(10, new AutomationQuery());   // it works
     
    /////////////////////////////////////////////////////////////////
     
     return base.HandleFault(executionContext, exception);
     
    //comme exception j'ai : "Could not find service of type 'AnAssembly.IExecuteExternalCode through the currently configured services. Consider adding the service to ExternalDataExchangeService"
     
    }
    Tout les objet que j'utrilise sont instancier.

    Merci

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    67
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 67
    Points : 63
    Points
    63
    Par défaut
    Si j'enlève le ReceiveActivity et que j'appelle le WF en local.
    Tout va bien.
    Si je Laisse le ReceiveActivity et que je l'appelle à travers un proxy, j'obtient a nouveau la même erreur.

    Quelqu'un a déjà réussit à appeler un CallExecuteMethod à travers un receiveActivity (hoster sur IIS) ?? ?? ??


    Je pense que le probleme vient du svc qui host le WF.
    Peut-être dois-je overrider la classe WorkflowServiceHostFactory.


    Merci

Discussions similaires

  1. Réponses: 9
    Dernier message: 16/03/2015, 19h05
  2. Réponses: 0
    Dernier message: 24/08/2011, 02h20
  3. [EasyMock] Vérifier qu'une méthode n'est jamais appelée
    Par proner dans le forum Tests et Performance
    Réponses: 1
    Dernier message: 26/03/2009, 18h13
  4. Probleme d'impression avec la méthode TForm->Print()
    Par Kid Icarus dans le forum C++Builder
    Réponses: 13
    Dernier message: 31/07/2002, 15h26
  5. Cryptage en C selon la méthode de césat
    Par shenron dans le forum C
    Réponses: 2
    Dernier message: 31/05/2002, 09h22

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