public static string ExecuteServiceOnLocalhostUsingProxy(string serviceName, Dictionary<string,string> payloadArguments)
{
CommunicationControllerFactory fact = new CommunicationControllerFactory();
var comm = fact.CreateController(serviceName);
var prx = new ServerProxy("http://localhost:3142", CredentialCache.DefaultNetworkCredentials, new TestAsyncWorker());
prx.Connect(Guid.NewGuid());
foreach (var payloadArgument in payloadArguments)
{
comm.AddPayloadArgument(payloadArgument.Key, payloadArgument.Value);
}
if(comm != null)
{
var messageToExecute = comm.ExecuteCommand<ExecuteMessage>(prx, Guid.Empty);
if(messageToExecute != null)
{
var responseMessage = messageToExecute.Message;
if(responseMessage != null)
{
var actual = responseMessage.ToString();
return actual;
}
return "Error: response message empty!";
}
return "Error: message to send to localhost server could not be generated.";
}
return "Error: localhost server controller could not be created.";
}