Calling Decisions Flows / Rules from Code
  • Updated on 05 Dec 2015
  • 1 minute to read
  • Print
  • Dark
    Light

Calling Decisions Flows / Rules from Code

  • Print
  • Dark
    Light

 // Run rule as GET           
 Stopwatch ruleGET = newStopwatch(); 
           for (int i = 0; i < iterations; i++)  
          { if (i == 5) { ruleGET.Start(); }
                string x = Get("http://localhost/decisions/sl/RunService/Test%20Hitting%20Flows/Rule%201?InstanceName=Decisions.CONTROLINSTANCE&sessionId=64eccfc2-583c-43e0-950f-ecdaaca370a9&outputType=Raw&ValueToTest=0&FirstText=sss"); 
               //Get("http://localhost/Default.htm");
            }
            ruleGET.Stop();
            Console.Out.WriteLine("Rule GET = " + ruleGET.ElapsedMilliseconds);
            Stopwatch rulePOST = newStopwatch();
            for (int i = 0; i < iterations; i++)
            {
                if (i == 5) { rulePOST.Start(); }
                string x = Post("http://localhost/decisions/sl/RunService/Test%20Hitting%20Flows/Rule%201?InstanceName=Decisions.CONTROLINSTANCE&sessionId=64eccfc2-583c-43e0-950f-ecdaaca370a9",
                    "{ \"outputType\": \"JSON\", \"ValueToTest\": \"0\", \"FirstText\": \"asdf\" }"
                );
            }
            rulePOST.Stop();
            Console.Out.WriteLine("Rule POST JSON = " + rulePOST.ElapsedMilliseconds);
            Stopwatch rulePOSTx = newStopwatch();
            for (int i = 0; i < iterations; i++)
            { if (i == 5) { rulePOSTx.Start(); }
                string x = Post("http://localhost/decisions/sl/RunService/Test%20Hitting%20Flows/Rule%201?InstanceName=Decisions.CONTROLINSTANCE&sessionId=64eccfc2-583c-43e0-950f-ecdaaca370a9",
                    "<parameters><outputtype>XML</outputtype><valuetotest>0</valuetotest><firsttext>asdf</firsttext></parameters>"
                );
            }
            rulePOSTx.Stop();
            Console.Out.WriteLine("Rule POST XML = " + rulePOSTx.ElapsedMilliseconds);

Multiple Approaches:

  1. Rest / POST / GET
    // Run rule as GET
    Stopwatch ruleGET = new Stopwatch ();
    for ( int i = 0; i < iterations; i++)
    {
    if (i == 5) { ruleGET.Start(); }
    string x = Get( "http://localhost/decisions/sl/RunService/Test%20Hitting%20Flows/Rule%201?InstanceName=Decisions.CONTROLINSTANCE&sessionId=64eccfc2-583c-43e0-950f-ecdaaca370a9&outputType=Raw&ValueToTest=0&FirstText=sss" );
    //Get("http://localhost/Default.htm");
    }
    ruleGET.Stop();
    Console .Out.WriteLine( "Rule GET = " + ruleGET.ElapsedMilliseconds);
    Stopwatch rulePOST = new Stopwatch ();
    for ( int i = 0; i < iterations; i++)
    {
    if (i == 5) { rulePOST.Start(); }
    string x = Post( "http://localhost/decisions/sl/RunService/Test%20Hitting%20Flows/Rule%201?InstanceName=Decisions.CONTROLINSTANCE&sessionId=64eccfc2-583c-43e0-950f-ecdaaca370a9" ,
    "{ "outputType": "JSON", "ValueToTest": "0", "FirstText": "asdf" }"
    );
    }
    rulePOST.Stop();
    Console .Out.WriteLine( "Rule POST JSON = " + rulePOST.ElapsedMilliseconds);
    Stopwatch rulePOSTx = new Stopwatch ();
    for ( int i = 0; i < iterations; i++)
    {
    if (i == 5) { rulePOSTx.Start(); }
    string x = Post( "http://localhost/decisions/sl/RunService/Test%20Hitting%20Flows/Rule%201?InstanceName=Decisions.CONTROLINSTANCE&sessionId=64eccfc2-583c-43e0-950f-ecdaaca370a9" ,
    " XML0asdf "
    );
    }
    rulePOSTx.Stop();
    Console .Out.WriteLine( "Rule POST XML = " + rulePOSTx.ElapsedMilliseconds);
  2. WCF
    Generating the reference.
    Generating the reference with CoreServiceClients.NET.dll and FW .dll
  3. FlowexecutionService
Was this article helpful?