private static void DownloadCotas(
            CVMWebCotas.WsDownloadInfsSoapClient client,
            InspectorBehavior requestInspector,
            CVMWebCotas.sessaoIdHeader login,
            String strData)
        {
            /*
            var lista = client.retornaListaComptcDocs(ref login, ID_TIPO_INFORME_DIARIO, strData);
            if (lista != null)
            {
                foreach (var item in lista)
                {
                    Console.WriteLine(item);
                }
            }
            else
            {
                Console.WriteLine("Nada retornado");
            }
            */

            Console.WriteLine("Pressione ENTER...");
            Console.ReadLine();
            var url = client.solicAutorizDownloadArqComptc(ref login, ID_TIPO_INFORME_DIARIO, strData, "Teste de sistema");
            Console.WriteLine("REQUEST:" + requestInspector.LastRequestXML);
            Console.WriteLine("RESPONSE:" + requestInspector.LastResponseXML);
            Console.WriteLine("URL: {0}", url);

            System.Windows.Forms.Clipboard.SetText(url);

            var filename = String.Format(@"C:\Temp\Cotas-{0}.zip", strData);
            DoDownload(url, filename);

            Console.WriteLine("Downloaded!");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Specify the endpoint on which the signing and inspector behavior is to be applied.
        /// </summary>
        /// <param name="endpoint">The service endpoint to process.</param>
        /// <param name="messageID">A UniqueId instance which specifies the ID of the request message.</param>
        /// <param name="signingCertificate">The X509Certificate2 instance which will be used to sign the request message.</param>
        /// <param name="soapMessages">A SoapMessages instance which will contain the soap request and response messages on the endpoint.</param>
        public static void ProcessEndpoint(
            ServiceEndpoint endpoint,
            X509Certificate2 signingCertificate,
            SoapMessages soapMessages)
        {
            // Add a behavior to remove reply-to and set the message id, to, from ws-address details
            InspectorBehavior newBehavior = new InspectorBehavior(soapMessages, signingCertificate);

            // Add the behavior
            endpoint.Behaviors.Add(newBehavior);
        }
        private static void DownloadAnual(
            CVMWebCotas.WsDownloadInfsSoapClient client,
            InspectorBehavior requestInspector,
            CVMWebCotas.sessaoIdHeader login)
        {
            var url = client.solicAutorizDownloadArqAnual(ref login, ID_TIPO_INFORME_DIARIO, "Teste de sistema");
            Console.WriteLine("REQUEST:" + requestInspector.LastRequestXML);
            Console.WriteLine("RESPONSE:" + requestInspector.LastResponseXML);
            Console.WriteLine("URL: {0}", url);

            System.Windows.Forms.Clipboard.SetText(url);

            var filename = String.Format(@"C:\Temp\Anual-{0:yyyyMMddHHmmss}.zip", DateTime.Now);
            DoDownload(url, filename);

            Console.WriteLine("Downloaded!");
        }
Ejemplo n.º 4
0
 public Message()
 {
     _Parameters         = new Dictionary <string, string>();
     _RequestInterceptor = new InspectorBehavior();
     _OperationSuccess   = true;
 }
        private static void DownloadFundos(
            CVMWebCotas.WsDownloadInfsSoapClient client,
            InspectorBehavior requestInspector,
            CVMWebCotas.sessaoIdHeader login,
            String strData)
        {
            var url = client.solicAutorizDownloadCadastro(ref login, strData, "Teste de Sistema");
            Console.WriteLine("REQUEST:" + requestInspector.LastRequestXML);

            var hdrs = requestInspector.LastRequestHeaders;
            if (hdrs != null)
            {
                Console.WriteLine("-- Headers ------------------------------------------------------------------------");
                foreach (var h in hdrs)
                {
                    Console.WriteLine(h);
                }
                Console.WriteLine("------------------------------------------------------------");
            }

            Console.WriteLine("RESPONSE:" + requestInspector.LastResponseXML);

            Console.WriteLine("URL: {0}", url);

            System.Windows.Forms.Clipboard.SetText(url);
            var filename = String.Format(@"C:\Temp\Fundos-{0}.zip", strData);

            DoDownload(url, filename);

            Console.WriteLine("Downloaded!");
        }
        static void Main(string[] args)
        {
            var client = new CVMWebCotas.WsDownloadInfsSoapClient();

            if (args.Length != 4)
            {
                PrintHelp();
                return;
            }

            try
            {
                idSistema = Int32.Parse(args[0]);
                senha = args[1];
                dias = Math.Abs(Int32.Parse(args[2])) * -1;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Erro: {0}", ex.Message);
                PrintHelp();
                return;
            }

            var requestInterceptor = new InspectorBehavior();
            client.Endpoint.EndpointBehaviors.Add(requestInterceptor);

            CVMWebCotas.sessaoIdHeader login = null;
            client.Login(ref login, idSistema, senha);
            Console.WriteLine("REQUEST:" + requestInterceptor.LastRequestXML);
            Console.WriteLine("RESPONSE:" + requestInterceptor.LastResponseXML);

            var strData = DateTime.Today.AddDays(dias).ToString("yyyy-MM-dd");
            Console.WriteLine("Looking for file from {0}...", strData);

            if ("FUNDO".Equals(args[3]))
            {
                DownloadFundos(client, requestInterceptor, login, strData);
            }
            else if ("COTAS".Equals(args[3]))
            {
                DownloadCotas(client, requestInterceptor, login, strData);
            }
            else if ("ANUAL".Equals(args[3]))
            {
                DownloadAnual(client, requestInterceptor, login);
            }
            else
            {
                PrintHelp();
                return;
            }

            Console.WriteLine("Pressione ENTER...");
            Console.ReadLine();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Specifies the endpoint to be inspected.
        /// </summary>
        /// <param name="endpoint">The service endpoint on which soap messages is to be inspected.</param>
        /// <param name="soapMessages">A SoapMessages instance which will contain the soap request and response messages on the endpoint.</param>
        public static void InspectEndpoint(ServiceEndpoint endpoint, SoapMessages soapMessages)
        {
            InspectorBehavior newBehavior = new InspectorBehavior(soapMessages);

            endpoint.Behaviors.Add(newBehavior);
        }