public Object execute(string className, string methodName, object[] args)
{
string userIdStr = "";
//if (_user != null)
//{
// userIdStr = _user.LogonSiteId.Id + '/' + _user.Uid + ": ";
//}
string fullClassName = className;
if (!fullClassName.StartsWith("gov."))
{
fullClassName = "gov.va.medora.mdws." + fullClassName;
}
Object theLib = Activator.CreateInstance(Type.GetType(fullClassName), new object[] { this });
Type theClass = theLib.GetType();
Type[] theParamTypes = new Type[args.Length];
for (int i = 0; i < args.Length; i++)
{
theParamTypes[i] = args[i].GetType();
}
MethodInfo theMethod = theClass.GetMethod(methodName, theParamTypes);
Object result = null;
if (theMethod == null)
{
result = new Exception("Method " + className + " " + methodName + " does not exist.");
}
try
{
result = theMethod.Invoke(theLib, BindingFlags.InvokeMethod, null, args, null);
}
catch (Exception e)
{
if (e.GetType().IsAssignableFrom(typeof(System.Reflection.TargetInvocationException)) &&
e.InnerException != null)
{
result = e.InnerException;
}
else
{
result = e;
}
return result;
}
return result;
}