ws-timbrado-client-2015-12-09.jar
The library contains the necessary classes to invoke the Stamping Webservice directly (creating the necessary objects and instances and making the manual invocation), or to invoke the methods that already handle the invocation themselves.
Download: ws-timbrado-client-2015-12-09.jar
Add library, netbeans or eclipse: 2.1.2. JAR Documentation.
Notes:
1.- These classes make direct use of the Stamping web service.
2.- This JAR includes the classes generated to directly call the stamping Webservice.
com.solucionfactible.cfdi.ws.timbrado.client
Stamp Class
com.solucionfactible.cfdi.ws.timbrado.client.Timbrado
Timbrado provides methods for stamping and canceling digital tax receipts.
To invoke the stamping method and send an e-document to the TESTING environment, you can do the following:
String user = "testing@solucionfactible.com";
String pass = "timbrado.SF.16672";
String rutaXML = "C:\CFDI_10F";
boolean produccion = false;
Timbrado timbrado = new Timbrado();
CFDICertificacion cert = timbrado.timbrar(user, pass, rutaXML, produccion);
System.out.println("WS Producción: " + (produccion ? "Si" : "No"));
System.out.println("Status: " + cert.getStatus());
System.out.println("Mensaje: " + cert.getMensaje());
CFDIResultadoCertificacion[] resultados = cert.getResultados();
if (resultados != null) {
for (CFDIResultadoCertificacion r : resultados) {
if (r != null) {
int rStatus = r.getStatus();
System.out.println(String.format("[%d] %s", rStatus, r.getMensaje()));
//Operación creada exitosamente o previamente ya creado
if (rStatus == 200) {
System.out.println(String.format("CFDI timbrado con folio: %s", r.getUuid()));
System.out.println(String.format("Certificado SAT: %s", r.getSelloSAT()));
System.out.println("Cadena original del Timbre Fiscal digital: " + r.getCadenaOriginal());
System.out.println("XML de CFDI con Timbre Fiscal Digital:");
//El CFDI con el TimbreFiscalDigital ya incluido
System.out.println(new String(r.getCfdiTimbrado()));
//Se usa la libreria de apache commons codec.
String qrCodeB64 = new String(org.apache.commons.codec.binary.Base64.encodeBase64(r.getQrCode()));
System.out.println("QRCode en base64: " + qrCodeB64);
}
System.out.println();
}
}
}
Possible misinterpretation due to duplicate methods
Note: the package com.solucionfactible.cfdi.ws.timbrado contains the classes and interfaces that can be used for direct invocation of the Webservice, and in turn contains a Stamped interface that should not be confused with the one defined in this document.
CFDICancelacion |
cancelar(String usuario, String password, String[] uuid, String cer, String key, String passwordCer)
Cancel a CFDI. |
CFDICertificacion |
timbrar(String usuario, String password, String archivo, boolean produccion)
Stamp a CFDI. |
cancel
public CFDICancelacion cancelar(String usuario,
String password,
String[] uuid,
String cer,
String key,
String passwordCer,
boolean produccion)
throws Exception
-
Cancels a given voucher and returns the Webservice response in an object of type
com.solucionfactible.cfdi.ws.timbrado.xsd.CFDICancelacion.CFDICancelacion
- Attributes of the CFDICancelacion, type are described in the following table:
-
Name Description Required status The operation status code. Cancellation response codes Yes mensaje The response message, a chain of characters detailing the status of the operation. Yes resultados An array of CFDIResultadoCancelacion. ttributes are detailed in the CFDIResultadoCancelacion table. No
- Attributes of the CFDIResultadoCancelacion
-
Name Description Required status Status of the CFDI cancellation result; for details of the cancellation status codes, please refer to Cancellation response codes. Yes mensaje Detailed message of the operation performed or description of the error. Yes uuid Tax ID of the CFDI that was cancelled. Yes statusUUID SAT response status for the receipt that was sent for cancellation; for details of the cancellation status codes see “SAT response codes for CFDI cancellation”. Conditional
- Parameters:
String usuario- The username (usually an email address) used to authenticate and connect to your implementation.String password- The user password.String[] uuid- An array of String objects containing the UUIDs to cancel, one in each String object.String cer- Path to the certificate file (.cer file).String key- Path to the certificate key (file .key).String passwordCer- Certificate password.boolean produccion- Boolean indicating whether the cancellation request should be sent to production (true) or to a testing environment (false).- Returns:
- A
com.solucionfactible.cfdi.ws.timbrado.xsd.CFDICancelacionobject that contains the response from the Webservice. - Throws:
- Exception - if a file cannot be found.
stamp
public CFDICertificacion timbrar(String usuario,
String password,
String archivo,
boolean produccion)
throws Exception
-
Stamp a given CFDI and return the WebService response in an object of type
com.solucionfactible.cfdi.ws.timbrado.xsd.CFDICertificacion - Atributes of CFDICertificacion, they describe it in the following table.
-
Name Description Required status The operation status code. Stamping response codes Yes mensaje The response message, a string of characters detailing the status of the operation. Yes resultados Un array de CFDIResultadoCertificacion, a composite type whose attributes are detailed in the table “Atributos de CFDIResultadoCertificacion”. No - Atributes of CFDIResultadoCertificacion
-
Name Description Required status Status of the CFDI validation and stamping result; for details of the certification status codes, see Stamping response codes. Yes mensaje Detailed message of the operation performed or description of the error. Yes uuid Tax ID of the CFDI that was stamped. Conditional versionTFD Digital Tax Stamp add-on version. Conditional fechaTimbrado CFDI stamping date. Conditional selloSAT SAT seal, the Digital Tax Stamp seal. Conditional certificadoSAT Serial number of the SAT certificate used to stamp the CFDI. Conditional cadenaOriginal Original string of the Digital Tax Stamp or Certification Complement. Conditional cfdiTimbrado CFDI with the Digital Tax Stamp. Conditional qrCode The two-dimensional QR Code of the CFDI, is the binary data of an image in png format. Conditional - Parameters:
String usuario- The username (usually an email address) used to authenticate and connect to your implementation.String password- The user password.String archivo- Path of the XML file to be stamped.boolean produccion- Flag specifying whether to send the receipt to production or to testing true=PRODUCCION- Returns:
- Un objeto
com.solucionfactible.cfdi.ws.timbrado.xsd.CFDICertificacionthat contains the response from the Webservice. - Throws:
- Exception if the file is not found or is not a regular file.