private object Invoke(object Instance, string methodName, object[] parameters)
{
try
{
//Relacionar o certificado digital que será utilizado no serviço que será consumido do webservice
this.RelacCertificado(Instance);
Type tipoInstance = Instance.GetType();
return tipoInstance.GetMethod(methodName).Invoke(Instance, parameters);
}
catch (Exception ex)
{
string msgErro = "Erro ao invocar o método '" + methodName + "'.\r\nWSDL: " + this.ArquivoWSDL + "\r\n" + ex.Message;
if (ex.InnerException != null)
{
msgErro += "\r\n " + ex.InnerException.Message;
if (ex.InnerException.InnerException != null)
{
msgErro += "\r\n " + ex.InnerException.InnerException.Message;
if (ex.InnerException.InnerException.InnerException != null)
{
msgErro += "\r\n " + ex.InnerException.InnerException.InnerException.Message;
if (ex.InnerException.InnerException.InnerException.InnerException != null)
{
msgErro += "\r\n " + ex.InnerException.InnerException.InnerException.InnerException.Message;
}
}
}
}
throw new Exception(msgErro);
}
}
#endregion