===== MÉTODOS WEB SERVICE ECUADOR OBJETO ===== [[start|{{ :iconos_presentacion-39.png?30x30}}]] try { Cuerpo cuerpo = new Cuerpo() { token = textBox161.Text, documentoElectronico = new DocumentoElectronico() }; cuerpo.documentoElectronico.encabezado = new Encabezado() { identificacionDocumento = new IdentificacionDocumento() { tipoDocumento = textBox4.Text, ncf = textBox5.Text, fechaVencimientoSecuencia = textBox6.Text, indicadorEnvioDiferido = textBox7.Text, indicadorMontoGravado = textBox8.Text, tipoIngresos = textBox10.Text, tipoPago = textBox11.Text, tablaFormasPago = new List() }, emisor = new Emisor() { rnc = textBox19.Text, razonSocial = textBox20.Text, nombreComercial = textBox21.Text, sucursal = textBox22.Text, direccion = textBox23.Text, municipio = textBox24.Text, provincia = textBox25.Text, tablaTelefono = new List(), correo = textBox26.Text, webSite = textBox27.Text, codigoVendedor = textBox29.Text, numeroFacturaInterna = textBox30.Text, numeroPedidoInterno = textBox31.Text, zonaVenta = textBox32.Text, //fechaEmision = textBox35.Text; fechaEmision = dateTimePicker1.Value.ToShortDateString().Replace("/","-") }, comprador = new Comprador() { rnc = textBox39.Text, razonSocial = textBox41.Text, contacto = textBox42.Text, correo = textBox43.Text, direccion = textBox44.Text, municipio = textBox45.Text, provincia = textBox46.Text, pais = textBox47.Text, fechaEntrega = textBox48.Text, fechaOrden = textBox52.Text, numeroOrden = textBox53.Text, codigoInterno = textBox54.Text, }, informacionesAdicionales = new InformacionesAdicionales() { numeroContenedor = textBox59.Text, numeroReferencia = textBox60.Text, }, totales = new Totales() { montoGravadoTotal = textBox94.Text, montoGravadoI1 = textBox95.Text, itbiS1 = textBox99.Text, totalITBIS = textBox102.Text, totalITBIS1 = textBox103.Text, montoTotal = textBox107.Text, }, }; TablaFormasPago item = new TablaFormasPago() { forma = "1", monto = textBox107.Text }; cuerpo.documentoElectronico.encabezado.identificacionDocumento.tablaFormasPago.Add(item); cuerpo.documentoElectronico.encabezado.emisor.tablaTelefono.Add("809-472-7676"); cuerpo.documentoElectronico.encabezado.emisor.tablaTelefono.Add("809-491-1918"); DetallesItem detalles = new DetallesItem() { numeroLinea = "1", indicadorFacturacion = "1", nombre = "ASW DTU", indicadorBienoServicio = "1", cantidad = "15", unidadMedida = "31", precioUnitario = "400.00", monto = "6000.00", descripcion="Una descripcion normal" }; DataGridViewButtonColumn edit=new DataGridViewButtonColumn(); edit.Visible = true; edit.Name = "Editar"; edit.Text = "Editar"; edit.UseColumnTextForButtonValue = true; dataGridView1.Columns.Add(edit); detallesItemBindingSource.DataSource = detalles; cuerpo.documentoElectronico.detallesItems = new List(); cuerpo.documentoElectronico.detallesItems.Add(detalles); HttpClient cliente = new HttpClient(); cliente.BaseAddress = new Uri("https://testemision.thefactoryhka.com.do"); cliente.DefaultRequestHeaders.Add("Authorization", "Bearer " + textBox161.Text); string jsonObject = JsonSerializer.Serialize(cuerpo); var content = new StringContent(jsonObject.ToString(), Encoding.UTF8, "application/json"); var resp = cliente.PostAsync("api/Enviar", content).Result; var resultado = resp.Content.ReadAsStringAsync(); string dame = resultado.Result; var Respuesta = JsonSerializer.Deserialize(dame); if (Respuesta.procesado == true) { richTextBox1.Text = Respuesta.codigo.ToString() + "\r\n" + Respuesta.mensaje + "\r\n" + Respuesta.procesado.ToString() + "\r\n" + Encoding.UTF8.GetString(Convert.FromBase64String(Respuesta.xmlBase64)); } else { richTextBox1.Text = Respuesta.codigo.ToString() + "\r\n" + Respuesta.mensaje + "\r\n" + Respuesta.procesado.ToString(); } } catch (Exception b) { MessageBox.Show(b.ToString()); } [[start|{{:60577.png?30 }}]]