public override int Execute(Object o, Hashtable inputData) { log.InfoFormat(job.KeyCode, "Module {0} received {1} inputs.", name, inputData != null ? inputData.Count.ToString() : "no"); int retval = 0; string flagIdInUse = ""; if (IfResetOnEachRun) ResetOutput(); PassAlongOutputs(inputData); PerfTimer hpt = new PerfTimer(); hpt.Start(); int activityIdStarting = UpdateProcessStatus(Enums.ProcessStatus.Starting, "", (State)o); string reportArgs = String.Empty; try { dtOut = new DataTable(tableName); Util.InitializeAsciiLookup(); ifRetry = true; bool isContingency = false; string runrepSessionID = String.Empty; reportResultsPortfolioStruct results = null; Service webServ = null; int numtries = 1; if (!job.JobName.StartsWith("ADHOC_")) PrepareDates(); ParseArgs(args, ref reportArgs); DateTime runStartTime = DateTime.Now; while (ifRetry) { try { webServ = null; while (webServ == null && numtries < 12) { log.InfoFormat(job.KeyCode, "Attempting Geneva SOAP RunCallableRunrepRunReport [retry #{3}] on {0} with report args {1} {2}", url, rsl, reportArgs, numtries); webServ = new Service(); if (webServ == null) Thread.Sleep(5000); numtries++; } if (webServ == null) { log.ErrorFormat(job.KeyCode, "Web service not constructed (null value)"); retval = -1; throw new ArgumentNullException("Web service not constructed (null value)") ; } else { log.InfoFormat(job.KeyCode, "Web service constructed successfully"); webServ.Timeout = timeout; log.InfoFormat(job.KeyCode, "Web service timeout assigned: {0}", timeout); webServ.Url = ConfigUtils.MetaTagReplacer(url); log.InfoFormat(job.KeyCode, "Web url assigned: {0}", webServ.Url); if (runrepSessionID.Equals(String.Empty)) { try { string flags = "-f empty"; flagIdInUse = safeFlags.Next(); //flags = String.Format("-n{0} -f empty", flagIdInUse); flags = String.Format("-n{0}", flagIdInUse); log.DebugFormat(job.KeyCode, "flags={0}", flags); string login = webServ.MonitorLogin("SysReports", "reports1"); webServ.MonitorAddUser(login, "SysReports"); Console.Write(webServ.GetGenevaIniInfo(runrepSessionID, "/usr/advent/geneva-qa")); Console.Write(webServ.GetAgaFileUtilityInfo(runrepSessionID, 0, "", "", "agb-geneva")); Console.Write(webServ.GetAllAgaFileUtilitiesForNewAgaInfo(runrepSessionID,0,"","","agb-geneva")); Console.Write(webServ.GetAllChildrenForMotherInfo(runrepSessionID, 0, "", "", "agb-geneva")); Console.Write(webServ.GetRepEngineInfo(runrepSessionID, 0, "", "", "agb-geneva")); Console.Write(webServ.GetRepQueueInfo(runrepSessionID, 0, "", "", "agb-geneva")); Console.Write(webServ.GetRunrepInfo(runrepSessionID, 0, "", "", "agb-geneva")); //runrepSessionID = webServ.StartPersistentCallableRunrep(port, host, uid, pwd, flags); // StartCallableRunrep(port, host, uid, pwd, flags); runrepSessionID = webServ.StartCallableRunrep(port, host, uid, pwd, flags); // StartCallableRunrep(port, host, uid, pwd, flags); log.InfoFormat(job.KeyCode, "Runrep session started successfully [Runrep ID: {0}]", runrepSessionID); } catch (Exception ex) { log.ErrorFormat(job.KeyCode, "Failed to start runrep session: {0} [Runrep ID: {1}]", ex, runrepSessionID); retval = -99; throw new ApplicationException(ex.ToString()); } } try { webServ.RunCallableRunrepReadFile(runrepSessionID, rsl); log.InfoFormat(job.KeyCode, "Runrep read report file was successful [Runrep ID: {0}]", runrepSessionID); } catch (Exception ex) { log.WarnFormat(job.KeyCode, "Failed to read rsl file from runrep session: {0} [Runrep ID: {1}]", ex, runrepSessionID); retval = -99; throw new ApplicationException(ex.ToString()); } try { results = webServ.RunCallableRunrepRunReport(runrepSessionID, rsl, reportArgs); log.InfoFormat(job.KeyCode, "Runrep run report was successful [Runrep ID: {0}]", runrepSessionID); } catch (Exception ex) { log.WarnFormat(job.KeyCode, "Runrep run report was NOT successful: {0} [Runrep ID: {1}]", ex, runrepSessionID); retval = -99; throw new ApplicationException(ex.ToString()); } if (isContingency) SendMailMessage(job.KeyCode, job.Config.SoapErrorEmailDistribution, ListFrom, Subject, "Geneva SOAP call succeeded."); try { safeFlags[flagIdInUse]= false; webServ.ShutdownCallableSession(runrepSessionID); log.InfoFormat(job.KeyCode, "Shut down SOAP session OK. [Runrep ID: {0}]", runrepSessionID); } catch (Exception ex) { retval = -1; log.WarnFormat(job.KeyCode, "Error shutting down SOAP session: {0} [Runrep ID: {1}]", ex, runrepSessionID); } ifRetry = false; } } catch (Exception ex) { try { webServ.ShutdownCallableSession(runrepSessionID); retval = -1; log.InfoFormat(job.KeyCode, "Shut down SOAP session OK {0}.", runrepSessionID); } catch (Exception exx) { log.WarnFormat(job.KeyCode, "Error shutting down SOAP session: {0} [Runrep ID: {1}]", exx, runrepSessionID); } log.ErrorFormat(job.KeyCode, "Error encountered in SOAP connection: {0}", ex); try { if (DateTime.Now.CompareTo(runStartTime.AddMinutes(minutesSoapRetry)) < 0) { isContingency = true; runrepSessionID = String.Empty; ifRetry = ifOverrideSoapErrorRetry ? false : true; log.ErrorFormat(job.KeyCode, "*** Contingency Condition *** "); if(ifRetry) log.ErrorFormat(job.KeyCode, "Retrying in {0} minutes.", 1); else log.ErrorFormat(job.KeyCode, "Retrying cancelled."); if (!ListTo.Equals(String.Empty)) SendMailMessage(job.KeyCode, ListTo, ListFrom, Subject, ex.ToString()); retval = -1; Thread.Sleep(60000); } else { log.ErrorFormat(job.KeyCode, "Geneva SOAP call timed out. Giving up now."); SendMailMessage(job.KeyCode, job.Config.SoapErrorEmailDistribution, ListFrom, Subject, "Geneva SOAP call timed out. Giving up now."); retval = -99; ifRetry = false; } } catch (Exception exfinal) { log.ErrorFormat(job.KeyCode, "Fatal error: {0}", exfinal); } } } if (results != null) { if (!ifUseAddendumErrorsOnly) dtOut = ConvertToDataTable(tableName, results); else dtOut = getAddendumErrors(tableName, results); } if (dtOut != null && dtOut.Rows.Count > 0) log.InfoFormat(job.KeyCode, "Obtained {0} records from SOAP service call.", dtOut.Rows.Count); else log.InfoFormat(job.KeyCode, "Obtained no records from SOAP service call."); if (dtOut != null) { AddToOutputs(this.Name, dtOut); AddToOutputs("RunDate", RunDate); } } catch (Exception ex) { log.Error(job.KeyCode, ex); retval = -99; } hpt.Stop(); int activityIdEnding = UpdateProcessStatus(Enums.ProcessStatus.Success, "", (State)o); log.InfoFormat(job.KeyCode, "GenevaSoapReport [{0}] completed in {1} seconds.", Name, hpt.Duration); return retval; }