Class to start and run callable runrep sessions via the Geneva SOAP interface.
Inheritance: GenevaSOAPSession
Exemplo n.º 1
0
        public List<Column> GetColumns( string reportName,
                                        string hostName,
                                        int soapPort,
                                        int genevaPort,
                                        string unixUserName,
                                        string unixPassword,
                                        string runrepUserName,
                                        string runrepPassword,
                                        string sshHostKeyFingerprint,
                                        string winSCPPath,
                                        string rslFilePath,
                                        string windowsOutput,
                                        string hostPortNo)
        {
            CallableRunrepSession runrep = null;
            WinSCPSession winSCP = null;

            List<String> headers = null;

            try
            {
                string soapURL = "http://" + hostName + ":" + soapPort;
                runrep = new CallableRunrepSession(soapURL, hostName, genevaPort, runrepUserName, runrepPassword, false);

                winSCP = new WinSCPSession(hostName, unixUserName, unixPassword, sshHostKeyFingerprint, hostPortNo);

                headers = runrep.GetHeaders(reportName, "-p " + UnselectedPortfolios[0], winSCPPath, rslFilePath, windowsOutput, winSCP);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                if (runrep != null) runrep.ShutdownSession();
            }

            List<Column> headerList = null;

            if (headers != null)
            {
                int i = 0;
                headerList = headers.Select(name => new Column(i++, name)).ToList();
            }

            return headerList;
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            CallableRunrepSession runrep = null;
            CallableLoaderSession loader = null;

            try
            {
                // Start the runrep session using our login info. Don't use a shared connection.
                runrep = new CallableRunrepSession(GENEVA_SOAP_URL, GENEVA_HOST_NAME, GENEVA_PORT, GENEVA_USERNAME, GENEVA_PASSWORD, false);

                // Run a simple Geneva SQL SELECT statement and print the results to the command line. Use a shared connection.
                runrep.RunSQLSelect("NameSort, NameLine1 from Exchange", CallableRunrepSession.RunrepResultTypes.DataStructure);

                // Run the select statement, but get the results back in object XML format.
                runrep.RunSQLSelect("NameSort, NameLine1 from Exchange", CallableRunrepSession.RunrepResultTypes.Literal);

                // Run the select statement, but get the results back in string XML format.
                runrep.RunSQLSelect("NameSort, NameLine1 from Exchange", CallableRunrepSession.RunrepResultTypes.String);

                // Run a report, and pass in the parameters. Literal results is an object that can be serialized to XML or the Console.
                runrep.RunReport("tranhist.rsl", "-p qacash", CallableRunrepSession.RunrepResultTypes.Literal);

                // Run a report, and pass in the parameters. Returns the results in String format that can be loaded into an XmlDocument.
                runrep.RunReport("tranhist.rsl", "-p qacash", CallableRunrepSession.RunrepResultTypes.String);

                // Run a formatted csv report, and pass in the parameters. Returns the name of a file that is
                // then streamed back locally and saved to a local file.
                runrep.RunReport("tranhist.rsl", "-p qacash", CallableRunrepSession.RunrepResultTypes.FormattedCSV);

                // Run a formatted pdf report, and pass in the parameters. Returns the name of a file that is
                // then streamed back locally and saved to a local file.
                runrep.RunReport("tranhist.rsl", "-p qacash", CallableRunrepSession.RunrepResultTypes.FormattedPDF);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error running report request.");
                Console.WriteLine(e);
            }
            finally
            {
                //If this is not a shared connection, shut it down.
                if (runrep != null)
                    runrep.ShutdownSession();
            }

            try
            {
                // Create the loader session using our login info.
                loader = new CallableLoaderSession(GENEVA_SOAP_URL, GENEVA_HOST_NAME, GENEVA_PORT, GENEVA_USERNAME, GENEVA_PASSWORD, false);

                // Load some simple XML, one successful record, one with an error.
                loader.LoadData(SAMPLE_LOADER_XML);
            }
            catch (Exception e)
            {
                Console.WriteLine("Error running data load.");
                Console.WriteLine(e);
            }
            finally
            {
                // If this is not a shared connection, we need to shut it down.
                if (loader != null)
                    loader.ShutdownSession();
            }
        }
Exemplo n.º 3
0
        public void GetCSVs(string hostName,
                            int soapPort,
                            int genevaPort,
                            string unixUserName,
                            string unixPassword,
                            string runrepUserName,
                            string runrepPassword,
                            string sshHostKeyFingerprint,
                            string winSCPPath,
                            string rslFilePath,
                            string windowsOutput,
                            string serverType,
                            string version,
                            string hostPortNo)
        {
            CallableRunrepSession runrep = null;
            WinSCPSession winSCP = null;

            try
            {
                string soapURL = "http://" + hostName + ":" + soapPort;
                runrep = new CallableRunrepSession(soapURL, hostName, genevaPort, runrepUserName, runrepPassword, false);

                winSCP = new WinSCPSession(hostName, unixUserName, unixPassword, sshHostKeyFingerprint, hostPortNo);

                String windowsOutputPath = windowsOutput + @"GFT_DiffTool_Output\" + DateTime.Today.ToString("yyyy-MM-dd")
                + "-" + version + @"\" + serverType + @"\";

                DirectoryInfo dir = new DirectoryInfo(windowsOutputPath);

                if (dir.Exists) { dir.Delete(true); }

                runrep.StartRunningReport += StartRunningReport;
                runrep.ReportReady += ReportReady;
                runrep.RunReports(SelectedReports, SelectedPortfolios, serverType, version, winSCP,
                                    winSCPPath, rslFilePath, windowsOutput);
                runrep.ReportReady -= ReportReady;
                runrep.StartRunningReport -= StartRunningReport;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                if (runrep != null) runrep.ShutdownSession();
            }
        }
Exemplo n.º 4
0
        public void GetPortfolios(  string hostName,
                                    int soapPort,
                                    int genevaPort,
                                    string runrepUserName,
                                    string runrepPassword,
                                    string windowsOutput)
        {
            try
            {
                string soapURL = "http://" + hostName + ":" + soapPort;
                runrep = new CallableRunrepSession(soapURL, hostName, genevaPort, runrepUserName, runrepPassword, false);
                UnselectedPortfolios = runrep.GetPortfolios("NameSort from Portfolio", windowsOutput);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            finally
            {
                if (runrep != null) runrep.ShutdownSession();
            }

            if (UnselectedPortfolios != null) UnselectedPortfolios.Sort();
        }