Proxy Service Interface C# Sample for Stateless and Stateful Tasks
These samples execute a task or series of tasks and display the results. The task is defined in a sample task file generated in the designer.
Stateless Proxy Service Interface C# Sample
using System;
using System.Xml;
using SCREENCONNECTORLib;
namespace CSharpApp
{
class Test
{
[STAThread]
static void Main(string[] args)
{
try
{
IConnectorProxy proxy = new ScreenConnectorProxyClass();
String result = proxy.Execute("com.attachmate.connectors.screen.ScreenConnectorAccessImpl",
"C:\\Program Files\\Attachmate\\EAI\\recordings\\Test\\connector\\Test.xml", "Task",
"<ScreenInputs><Input>data</Input></ScreenInputs>");
System.Console.Out.WriteLine(result);
}
catch (Exception xx)
{
System.Console.Error.WriteLine(xx.ToString());
}
}
}
}
Stateful Proxy Service Interface C# Sample
using System;
using System.Xml;
using SCREENCONNECTORLib;
namespace CSharpApp
{
class Test
{
[STAThread]
static void Main(string[] args)
{
IConnectorProxy proxy = null;
try
{
proxy = new ScreenConnectorProxyClass();
proxy.Open("com.attachmate.connectors.screen.ScreenConnectorAccessImpl",
"C:\\Program Files\\Attachmate\\EAI\\recordings\\Test\\connector\\Test2.xml");
String result1 = proxy.Exec("StatefulTask1",
"<ScreenInputs><Input>data1</Input></ScreenInputs>");
System.Console.WriteLine(result1);
String result2 = proxy.Exec("StatefulTask2",
"<ScreenInputs><Input>data2</Input></ScreenInputs>");
System.Console.WriteLine(result2);
}
catch (Exception xx)
{
System.Console.Error.WriteLine(xx);
}
finally
{
proxy.Close();
}
}
}
}