Consult WebService

0

Good afternoon, I have the following data in a table in Sql

Comprobante Categoria
    603552       A
    624997       A
    651880       A
    672298       C
    615985       C
    613804       C
    617970       A
    625688       A
    689463       B
    611686       B

Then I generate a console application that consults the WebService taking the voucher number and downloading a .pdf, but I block, this application has to generate a folder by Category taking the value of the sql query from the Vouchers table and inside from each folder download the corresponding invoice to that category so the invoices are sorted by category within each folder. I appreciate all the help.

 static void Main(string[] args)
        {
            string url = null;
string strSQL = "SELECT numeroComprobante,categoria FROM Comprobantes";

            SqlConnection con = new SqlConnection("********");
            SqlCommand cmd = new SqlCommand(strSQL, con);
            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                var request = new Services.consultarDocumento()
                {
                    request = new Services.requestConsultaDocumento()
                    {

                        numeroComprobante = reader["numeroComprobante"],
                    }

                };

            var address = new EndpointAddress(new Uri("*********"));

            BasicHttpBinding binding = new BasicHttpBinding();
            binding.Name = "basicHttpBinding";
            binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
            binding.Security.Mode = BasicHttpSecurityMode.None;

            var client = new Services.ConsultaDocumentoClient(binding, address);

            var response = client.consultarDocumento(request);

            var Factura= @return.Documento;
            }

            reader.Close();
            con.Close();

    }
  }
    
asked by Sebastian 08.10.2017 в 23:17
source

0 answers