Nothing Special   »   [go: up one dir, main page]

Webservice SAT CFDI 3.3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

│ │
1
Tabla de Contenido

1 Descripción .......................................................................................................... 3

2 Contrato ............................................................................................................... 4

3 Mensajes de Respuesta ........................................................................................ 9

Mensajes de Rechazo. ........................................................................................................... 9

Mensajes de Aceptación. ...................................................................................................... 10

4 Ejemplo de Implementación ................................................................................ 10

5 Capacidad de respuesta ....................................................................................... 14


│ │
2
1. Descripción
El Servicio de consulta de CFDI´s se diseñó para permitir la validación accediendo a un servicio
publicado en la página del SAT, el servicio pretende proveer una alternativa de consulta que
requiera verificar el estado de un comprobante en las Bases de Datos del SAT.


│ │
3
2. Contrato
URL: https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc

WSDL ConsultaCFDIService.svc?wsdl

WSDL location: https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?wsdl


targetnamespace http://tempuri.org

services bindings porttypes messages types


ConsultaCFDIService BasicHttpBinding_ICon IConsultaCF IConsultaCFDIService_Cons expresionimpresa
sultaCFDIService DIService ulta_InputMessage
IConsultaCFDIService_Cons Acuse
ulta_OutputMessage
anyType
anyURI
base64Bin ary
boolean
byte
char
char
Consulta
ConsultaR
esponse
dateTime
decimal
double
duration
duration
float
guid
guid
int
long
QName
short
string
unsignedB yte
unsignedI nt
unsignedL ong
unsignedS
hort


│ │
4
service ConsultaCFDIService
diagra
m

ports
BasicHttpBinding_IConsultaCFDIService
binding tns:BasicHttpBinding_IConsultaCFDIService
extensibility <soap:address
location="https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDISer
vice.svc"/>
source <wsdl:service name="ConsultaCFDIService">
<wsdl:port name="BasicHttpBinding_IConsultaCFDIService"
binding="tns:BasicHttpBinding_IConsultaCFDIService">
<soap:address
location="https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc"/>
</wsdl:port>
</wsdl:service>

binding BasicHttpBinding_IConsultaCFDIService
diagram

type tns:IConsultaCFDIService

extensibility <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>


operations Consulta
extensibility <soap:operation
soapAction="http://tempuri.org/IConsultaCFDIService/Consulta"
style="document"/>
input <soap:body use="literal"/>
output <soap:body use="literal"/>


│ │
5
used by Port BasicHttpBinding_IConsultaCFDIService in Service ConsultaCFDIService

source <wsdl:binding name="BasicHttpBinding_IConsultaCFDIService" type="tns:IConsultaCFDIService">


<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsp:PolicyReference URI="#BasicHttpBinding_IConsultaCFDIService_policy"/>
<wsdl:operation name="Consulta">
<soap:operation soapAction="http://tempuri.org/IConsultaCFDIService/Consulta"
style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

porttype IConsultaCFDIService
diagram

operations Consulta
input tns:IConsultaCFDIService_Consulta_InputMessage
output tns:IConsultaCFDIService_Consulta_OutputMessage
used by binding BasicHttpBinding_IConsultaCFDIService

source <wsdl:portType name="IConsultaCFDIService">


<wsdl:operation name="Consulta">
<wsdl:input message="tns:IConsultaCFDIService_Consulta_InputMessage"
wsaw:Action="http://tempuri.org/IConsultaCFDIService/Consulta"/>
<wsdl:output message="tns:IConsultaCFDIService_Consulta_OutputMessage"
wsaw:Action="http://tempuri.org/IConsultaCFDIService/ConsultaResponse"/> </wsdl:operation>
</wsdl:portType>

message IConsultaCFDIService_Consulta_InputMessage
parts parameters
element tns:Consulta

used by Operation Consulta in PortType IConsultaCFDIService


│ │
6
source <wsdl:message name="IConsultaCFDIService_Consulta_InputMessage">
<wsdl:part name="parameters" element="tns:Consulta"/>
</wsdl:message>

message IConsultaCFDIService_Consulta_OutputMessage
parts parameters
element tns:ConsultaResponse

used by Operation Consulta in PortType IConsultaCFDIService

source <wsdl:message name="IConsultaCFDIService_Consulta_OutputMessage">


<wsdl:part name="parameters" element="tns:ConsultaResponse"/>
</wsdl:message>

element Consulta
diagram

namespace http://tempuri.org/

properties content complex

children tns:expresionImpresa

source <xsd:element name="Consulta">


<xsd:complexType>
<xsd:sequence>
<xsd:element name="expresionImpresa" type="xs:string" nillable="true"
minOccurs="0"/> </xsd:sequence>
</xsd:complexType>
</xsd:element>

element ConsultaResponse
diagram

namespace http://tempuri.org/

properties content complex

children tns:ConsultaResult


│ │
7
source <xsd:element name="ConsultaResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ConsultaResult" type="q1:Acuse" nillable="true"
minOccurs="0"/> </xsd:sequence>
</xsd:complexType>
</xsd:element>

CODIGO

<?xml version="1.0" encoding="utf8" ?>


<wsdl:definitions name="ConsultaCFDIService" targetNamespace="http://tempuri.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsu="http://docs.oasisopen.org/wss/2004/01/oasis200401wsswssecurityutility1.0.xsd"
xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<wsp:Policy wsu:Id="BasicHttpBinding_IConsultaCFDIService_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false" />
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
+ <wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Strict />
</wsp:Policy>
</sp:Layout>
</wsp:Policy>
</sp:TransportBinding>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?xsd =xsd0"
namespace="http://tempuri.org/" />
<xsd:import schemaLocation="https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?xsd =xsd1"
namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
<xsd:import schemaLocation="https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc?xsd


│ │
8
=xsd2" namespace="http://schemas.datacontract.org/2004/07/Sat.Cfdi.Negocio.ConsultaCfdi.Servicio" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="IConsultaCFDIService_Consulta_InputMessage">
<wsdl:part name="parameters" element="tns:Consulta" />
</wsdl:message>
<wsdl:message name="IConsultaCFDIService_Consulta_OutputMessage">
<wsdl:part name="parameters" element="tns:ConsultaResponse" /> </wsdl:message>
<wsdl:portType name="IConsultaCFDIService">
<wsdl:operation name="Consulta">
<wsdl:input wsaw:Action="http://tempuri.org/IConsultaCFDIService/Consulta"
message="tns:IConsultaCFDIService_Consulta_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IConsultaCFDIService/ConsultaResponse"
message="tns:IConsultaCFDIService_Consulta_OutputMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IConsultaCFDIService" type="tns:IConsultaCFDIService">
<wsp:PolicyReference URI="#BasicHttpBinding_IConsultaCFDIService_policy" />
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Consulta">
<soap:operation soapAction="http://tempuri.org/IConsultaCFDIService/Consulta" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ConsultaCFDIService">
<wsdl:port name="BasicHttpBinding_IConsultaCFDIService" binding="tns:BasicHttpBinding_IConsultaCFDIService">
<soap:address location="https://consultaqr.facturaelectronica.sat.gob.mx/ConsultaCFDIService.svc"
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

3. Mensajes de Respuesta
Los mensajes de respuesta que arroja el servicio de consulta de CFDI´s incluyen la descripción del
resultado de la operación que corresponden a la siguiente clasificación:

Mensajes de Rechazo.
N 601: La expresión impresa proporcionada no es válida.

Este código de respuesta se presentará cuando la petición de validación no se haya respetado en


el formato definido.

N 602: Comprobante no encontrado.


│ │
9
Este código de respuesta se presentará cuando el UUID del comprobante no se encuentre en la
Base de Datos del SAT.

Mensajes de Aceptación.
S Comprobante obtenido satisfactoriamente.

4. Ejemplo de Implementación
namespace Sat.Cfdi.Negocio.ConsultaCfdi.Servicio
{
using System.Runtime.Serialization;
using System;

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="Acuse",
Namespace="http://schemas.datacontract.org/2004/07/Sat.Cfdi.Negocio.ConsultaCfdi.Servicio")]
[System.SerializableAttribute()]
public partial class Acuse : object, System.Runtime.Serialization.IExtensibleDataObject,
System.ComponentModel.INotifyPropertyChanged {

[System.NonSerializedAttribute()]
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;

[System.Runtime.Serialization.OptionalFieldAttribute()]
private string CodigoEstatusField;

[System.Runtime.Serialization.OptionalFieldAttribute()]
private string EsCancelableField;

[System.Runtime.Serialization.OptionalFieldAttribute()]
private string EstadoField;

[System.Runtime.Serialization.OptionalFieldAttribute()]
private string EstatusCancelacionField;

[global::System.ComponentModel.BrowsableAttribute(false)]
public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
get {
return this.extensionDataField;
}
set {
this.extensionDataField = value;
}
}

[System.Runtime.Serialization.DataMemberAttribute()]
public string CodigoEstatus {


│ │
10
get {
return this.CodigoEstatusField;
}
set {
if ((object.ReferenceEquals(this.CodigoEstatusField, value) != true)) {
this.CodigoEstatusField = value;
this.RaisePropertyChanged("CodigoEstatus");
}
}
}

[System.Runtime.Serialization.DataMemberAttribute()]
public string EsCancelable {
get {
return this.EsCancelableField;
}
set {
if ((object.ReferenceEquals(this.EsCancelableField, value) != true)) {
this.EsCancelableField = value;
this.RaisePropertyChanged("EsCancelable");
}
}
}

[System.Runtime.Serialization.DataMemberAttribute()]
public string Estado {
get {
return this.EstadoField;
}
set {
if ((object.ReferenceEquals(this.EstadoField, value) != true)) {
this.EstadoField = value;
this.RaisePropertyChanged("Estado");
}
}
}

[System.Runtime.Serialization.DataMemberAttribute()]
public string EstatusCancelacion {
get {
return this.EstatusCancelacionField;
}
set {
if ((object.ReferenceEquals(this.EstatusCancelacionField, value) != true)) {
this.EstatusCancelacionField = value;
this.RaisePropertyChanged("EstatusCancelacion");
}
}
}

public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

protected void RaisePropertyChanged(string propertyName) {


│ │
11
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]

[System.ServiceModel.ServiceContractAttribute(ConfigurationName="ConsultaCFDIService.IConsultaCFDIService")
]
public interface IConsultaCFDIService {

[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IConsultaCFDIService/Consulta",
ReplyAction="http://tempuri.org/IConsultaCFDIService/ConsultaResponse")]
QRConsola.ConsultaCFDIService.Acuse Consulta(string expresionImpresa);

[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IConsultaCFDIService/Consulta",
ReplyAction="http://tempuri.org/IConsultaCFDIService/ConsultaResponse")]
System.Threading.Tasks.Task<QRConsola.ConsultaCFDIService.Acuse> ConsultaAsync(string
expresionImpresa);
}

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface IConsultaCFDIServiceChannel : QRConsola.ConsultaCFDIService.IConsultaCFDIService,
System.ServiceModel.IClientChannel {
}

[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class ConsultaCFDIServiceClient :
System.ServiceModel.ClientBase<QRConsola.ConsultaCFDIService.IConsultaCFDIService>,
QRConsola.ConsultaCFDIService.IConsultaCFDIService {

public ConsultaCFDIServiceClient() {
}

public ConsultaCFDIServiceClient(string endpointConfigurationName) :


base(endpointConfigurationName) {
}

public ConsultaCFDIServiceClient(string endpointConfigurationName, string remoteAddress) :


base(endpointConfigurationName, remoteAddress) {
}

public ConsultaCFDIServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress


remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}


│ │
12
public ConsultaCFDIServiceClient(System.ServiceModel.Channels.Binding binding,
System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}

public QRConsola.ConsultaCFDIService.Acuse Consulta(string expresionImpresa) {


return base.Channel.Consulta(expresionImpresa);
}

public System.Threading.Tasks.Task<QRConsola.ConsultaCFDIService.Acuse> ConsultaAsync(string


expresionImpresa) {
return base.Channel.ConsultaAsync(expresionImpresa);
}
}
}


│ │
13
5. Capacidad de respuesta
El servicio de Consulta de CFDI´s tiene la capacidad de atender hasta 2 millones de consultas por
hr., debido a que estas consultas acceden las Bases de Datos transaccionales del SAT se solicita no
aumentar la cantidad de consultas por hora para evitar impactos en la respuesta del servicio.


│ │
14

You might also like