Calling Decisions Flows / Rules from Code

Last Updated: 03/28/2018 Introduced in Version: 2.0

 

Multiple Approaches:

1. Rest / POST / GET

// 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);

2. WCF

Generating the reference.

Generating the reference with CoreServiceClients.NET.dll and FW .dll 

3. FlowexecutionService

 

Additional Resources