PDA

Ver la Versión Completa : Web Service timbrado CFDI


Alexis De la Cr
06-11-2012, 06:03:21
Estimados conpañeros del foro

como programador me han encargo crear un modulo de timbrado para factura electronica, sin embargo aunque he leido tutoriales de webservice y me he informado, los ejemplos que he encontrado son bastante sencillos y ya aplicados al web service del timbrador la verdad es que se me dificulta entenderle.

les anexo, la unidad que se utiliza para el webservice

// ************************************************************************ //
// The types declared in this file were generated from data read from the
// WSDL File described below:
// WSDL : http://201.155.181.40:59080/axis2/services/TimbradorIntegradores?wsdl
// >Import : http://201.155.181.40:59080/axis2/services/TimbradorIntegradores?wsdl:0
// Encoding : UTF-8
// Version : 1.0
// (12/04/2012 06:31:38 p.m. - * $Rev: 5154 $)
// ************************************************************************ //

unit TimbradorIntegradores;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

const
IS_OPTN = $0001;
IS_UNBD = $0002;
IS_NLBL = $0004;
IS_UNQL = $0008;
IS_ATTR = $0010;
IS_TEXT = $0020;

type

// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"

get = class; { "http://integradores.cfdi.mx.konesh.com"[!U][GblElm] }
Exception = class; { "http://integradores.cfdi.mx.konesh.com"[!U][GblCplx] }
getResponse = class; { "http://integradores.cfdi.mx.konesh.com"[!U][GblElm] }
TimbradorIntegradoresException = class; { "http://integradores.cfdi.mx.konesh.com"[!U][GblElm] }



// ************************************************************************ //
// XML : get, global, <element>
// Namespace : http://integradores.cfdi.mx.konesh.com
// ************************************************************************ //
get = class(TRemotable)
private
Fcad: WideString;
Ftk: WideString;
Fuser: WideString;
Fpass: WideString;
Fcuenta: WideString;
published
property cad: WideString Index (IS_OPTN or IS_NLBL) read Fcad write Fcad;
property tk: WideString Index (IS_OPTN or IS_NLBL) read Ftk write Ftk;
property user: WideString Index (IS_OPTN or IS_NLBL) read Fuser write Fuser;
property pass: WideString Index (IS_OPTN or IS_NLBL) read Fpass write Fpass;
property cuenta: WideString Index (IS_OPTN or IS_NLBL) read Fcuenta write Fcuenta;
end;



// ************************************************************************ //
// XML : Exception, global, <complexType>
// Namespace : http://integradores.cfdi.mx.konesh.com
// ************************************************************************ //
Exception = class(TRemotable)
private
FMessage_: WideString;
published
property Message_: WideString Index (IS_OPTN or IS_NLBL) read FMessage_ write FMessage_;
end;



// ************************************************************************ //
// XML : getResponse, global, <element>
// Namespace : http://integradores.cfdi.mx.konesh.com
// ************************************************************************ //
getResponse = class(TRemotable)
private
Freturn: WideString;
published
property return: WideString Index (IS_OPTN or IS_NLBL) read Freturn write Freturn;
end;



// ************************************************************************ //
// XML : TimbradorIntegradoresException, global, <element>
// Namespace : http://integradores.cfdi.mx.konesh.com
// ************************************************************************ //
TimbradorIntegradoresException = class(TRemotable)
private
FTimbradorIntegradoresException: Exception;
public
destructor Destroy; override;
published
property TimbradorIntegradoresException: Exception Index (IS_OPTN or IS_NLBL) read FTimbradorIntegradoresException write FTimbradorIntegradoresException;
end;



implementation
uses SysUtils;

destructor TimbradorIntegradoresException.Destroy;
begin
FreeAndNil(FTimbradorIntegradoresException);
inherited Destroy;
end;

initialization
RemClassRegistry.RegisterXSClass(get, 'http://integradores.cfdi.mx.konesh.com', 'get');
RemClassRegistry.RegisterXSClass(Exception, 'http://integradores.cfdi.mx.konesh.com', 'Exception');
RemClassRegistry.RegisterExternalPropName(TypeInfo(Exception), 'Message_', 'Message');
RemClassRegistry.RegisterXSClass(getResponse, 'http://integradores.cfdi.mx.konesh.com', 'getResponse');
RemClassRegistry.RegisterXSClass(TimbradorIntegradoresException, 'http://integradores.cfdi.mx.konesh.com', 'TimbradorIntegradoresException');

end.


Espero no violar ninguna norma, pero como la aplico?

porque he encontrado ejemplos com este


try {
$client = new SoapClient("http://testing.solucionfactible.com/ws/services/Timbrado?wsdl");
$params = array('usuario' => $usuario, 'password' => $password, 'cfdiBase64'=>$b64, 'zip'=>False);
$response = $client->__soapCall('timbrarBase64', array('parameters' => $params));
} catch (SoapFault $fault) {
echo "SOAPFault: ".$fault->faultcode."-".$fault->faultstring."\n";}


deduzco que hay que armar una llamada a una funcion en este caso get, con valores. aqui es donde ya no le hallo.

Gracias

AzidRain
08-11-2012, 02:20:56
El webservice que quieres usar es del proveedor "SuFacturacion", quien a su vez lo subcontrato al parecer con otro desarrollador. En teoría un timbrador por webservice debe ser tan simple como pasarle una "cadena original" y un "certificado" y nos devolverá el "sello digital correspondiente" que es lo que requerimos para nuestros desarrollos. Desgraciadamente en México casi ningún "timbrador" autorizado lo ha hecho tan sencillo a pesar de que cobran por cada timbrado, salvo Contpaq que si bien no cobra, te cobra por comprarles su SDK.

Además de ello, muchos timbradores registrados o proveedores autorizados de CFDI por el SAT a su vez redistribuyen con terceros quienes son los que al final dan la cara al usuario como me imagio que es tu caso. "solucionfactible.com" es un simple revendedor de "SuFacturacion". En el codigo que pusiste de ejemplo se ve que en efecto solo tienes que llamar al servicio y los resultados se guardan en la variable $result.

No indicas si lo que quieres hacer es "timbrar" los CFDI o solo enviarlos a un proveedor para que los timbre

edorantes
08-11-2012, 20:07:13
Hola yo estoy case en lo mismo tengo que conectarme por medio de webservice a un pac.
La conexion ya la he hecho por asi decirlo won el wsdl importer mi problema es como implementar las funciones que se me han creado estoy en cero