====== Método CargaCertificado() ======
[[manual_de_integracion_obj|{{ :60577.png?30x30}}]]
El request del método es el siguiente:
| Request: Parámetro a enviar |||
^ **Tipo** ^ **Identificador** ^ **Descripción** ^
| String | Password | Proporcionado por The Factory HKA. |
| String | RUC | Proporcionado por el cliente. |
| String | Usuario | Proporcionado por The Factory HKA. |
| String | Certificado | Proporcionado por The Factory HKA. |
| String | Clave Certificado | Proporcionado por The Factory HKA. |
----
== XML EJEMPLO ==
?
?
?
?
?
?
----
=== Proceso para consumo CargaCertificado ===
* Se inicializa un objeto ServiceClient o Servicio
* Se inicializa un objeto PeticionCargaCertificado donde se ingresan el RUC, el usuario de Integración ,clave de Integración y Documento
* Se hace consumo del método CargaCertificado contenido en el objeto serviceClient y se coloca como parámetro la petición anterior, la respuesta estará contenida en un objeto llamado, la respuesta tendrá los parámetros Código y Mensaje // //
try
{
ServiceClient serv = new ServiceClient();
PeticionCargaCertificado pet = new PeticionCargaCertificado();
pet.RUC = textBox2.Text;
pet.Usuario = textBox3.Text;
pet.Clave = textBox4.Text;
string ext = textBox1.Text;
if (ext.Contains(".p12"))
{
pet.Extension = "p12";
}
if (ext.Contains(".pfx"))
{
pet.Extension = "pfx";
}
byte[] a = File.ReadAllBytes(textBox1.Text); //convertimos el certificado en base64
string CertConv = Convert.ToBase64String(a);
byte[] b = Encoding.ASCII.GetBytes(textBox5.Text);
pet.Certificado = CertConv;
pet.ClaveCertificado = Convert.ToBase64String(b);
var resp = serv.CargaCertificado(pet);
richTextBox1.Text = "Código: " + resp.Codigo + "\r\n" + "Mensaje: " + "\r\n" + resp.Mensaje + "\r\n" + resp.FechaVigenciaInicio + "\r\n" + resp.FechaVigenciaFin + "\r\n" + resp.RUC;
}
catch (Exception ex)
{
MessageBox.Show("Mensaje error: " + ex);
}
**El campo "Certificado" Y "ClaveCertificado" deben ser expresados en Base64**
----
[[manual_de_integracion_obj|{{:60577.png?30x30 }}]]
----