Ejemplo de request XML para enviar CFDI a Web service HEB
Publicado: Jue Mar 31, 2016 10:42 pm
Hola todos,
Estoy desarrollando una app en la empresa donde trabajo para poder enviar facturas CFDI por Web Service a HEB usando PHP.
Estoy atorado creando el request XML para el método setDigitalInvoice, he buscado en Google, en este foro, contacté al H. departamento de soportefe de HEB y no he conseguido un ejemplo válido de este request que funcione para CFDI 3.2. Sí encontré un ejemplo para envío de CFDI v2, y lo que hice fue adaptar ese código (a mi entendimiento) para poder enviar el CFDI versión 3.2. Sin embargo, todas las veces el web service se limita a responder Unssupported Request Type.
Obtengo el mismo mensaje en SOAPUI y en PHP usando SOAP y CURL, por lo que estoy seguro que el problema no está en el código de la conexión como tal, sino en la estructura de mi request XML. Esta es una de las pruebas de request que hice:
¿Podría alguien por favor echarme la mano con un request XML de ejemplo para este método que funcione con CFDI 3.2? El que necesito es el de setDigitalInvoice, el de getMessage me funciona correctamente.
Mil gracias.
Estoy desarrollando una app en la empresa donde trabajo para poder enviar facturas CFDI por Web Service a HEB usando PHP.
Estoy atorado creando el request XML para el método setDigitalInvoice, he buscado en Google, en este foro, contacté al H. departamento de soportefe de HEB y no he conseguido un ejemplo válido de este request que funcione para CFDI 3.2. Sí encontré un ejemplo para envío de CFDI v2, y lo que hice fue adaptar ese código (a mi entendimiento) para poder enviar el CFDI versión 3.2. Sin embargo, todas las veces el web service se limita a responder Unssupported Request Type.
Obtengo el mismo mensaje en SOAPUI y en PHP usando SOAP y CURL, por lo que estoy seguro que el problema no está en el código de la conexión como tal, sino en la estructura de mi request XML. Esta es una de las pruebas de request que hice:
Código: Seleccionar todo
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:dig="http://xmlns.heb.com/ei/DIGITAL_INVOICE_REQUEST" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><env:Header xmlns:env="http://www.w3.org/2003/05/soap-envelope">
<wsse:Security env:mustUnderstand="true">
<wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>AQUI_EL_USUARIO</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">AQUI_VA_EL_PASSWORD</wsse:Password>
<wsse:Nonce>MjAxNi0wMy0zMVQyMjoxMDowN1o=</wsse:Nonce>
</wsse:UsernameToken>
</wsse:Security>
</env:Header>
<soap:Body>
<dig:SET_DIGITAL_INVOICE_REQUEST>
<ISBUREAU>1</ISBUREAU>
<Comprobante xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:detallista="http://www.sat.gob.mx/detallista" xsi:schemaLocation="http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv32.xsd http://www.sat.gob.mx/detallista http://www.sat.gob.mx/sitio_internet/cfd/detallista/detallista.xsd" version="3.2" fecha="2016-03-11T16:39:08" formaDePago="Pago en una sola exhibicion" noCertificado="00000000000000000123" certificado="UcW(...)X2w==" Moneda="MXN" tipoDeComprobante="traslado" metodoDePago="236y7u8" LugarExpedicion="2345" subTotal="205.000000" descuento="0.000000" total="237.800000" sello="x8SOr3nOG(...)vo=">
<Emisor rfc="AAD990814BP7" nombre="Asociacion de agricultores del Distrito de Riego 004 Don Martin">
<DomicilioFiscal calle="Calle de la amargura" noExterior="752" noInterior="Segundo Piso" colonia="Centro" municipio="Venustiano Carranza" estado="Distrito Federal" pais="Mexico" codigoPostal="15900"/>
<RegimenFiscal Regimen="Regimen general de ley personas morales"/>
</Emisor>
<Receptor rfc="HEB110101ABC" nombre="HEB algo SA DE CV">
<Domicilio calle="Falsa" noExterior="123" noInterior="2" colonia="Del Pueblo" municipio="Monterrey" estado="Nuevo Leon" pais="Mexico" codigoPostal="06060"/>
</Receptor>
<Conceptos>
<Concepto cantidad="1.000000" unidad="Pieza" noIdentificacion="00000" descripcion="Concepto de prueba" valorUnitario="105.000000" importe="105.000000"/>
</Conceptos>
<Impuestos totalImpuestosTrasladados="32.800000">
<Traslados>
<Traslado impuesto="IVA" tasa="16.000000" importe="32.800000"/>
</Traslados>
</Impuestos>
<Complemento>
<detallista:detallista type="SimpleInvoiceType" documentStructureVersion="AMC8.1" documentStatus="ORIGINAL" contentVersion="1.3.1">
<detallista:requestForPaymentIdentification>
<detallista:entityType>TRANSPORT_DOCUMENT</detallista:entityType>
</detallista:requestForPaymentIdentification>
<detallista:specialInstruction code="ZZZ">
<detallista:text>DOSCIENTOS TREINTA Y SIETE 80/100 PESOS MXN</detallista:text>
</detallista:specialInstruction>
<detallista:orderIdentification>
<detallista:referenceIdentification type="ON">PEDI1</detallista:referenceIdentification>
<detallista:ReferenceDate>2016-03-11</detallista:ReferenceDate>
</detallista:orderIdentification>
<detallista:AdditionalInformation>
<detallista:referenceIdentification type="ON">2016-03-11</detallista:referenceIdentification>
</detallista:AdditionalInformation>
<detallista:buyer>
<detallista:gln>7504000225003</detallista:gln>
</detallista:buyer>
<detallista:seller>
<detallista:gln>3210987654321</detallista:gln>
<detallista:alternatePartyIdentification type="SELLER_ASSIGNED_IDENTIFIER_FOR_A_PARTY">1105</detallista:alternatePartyIdentification>
</detallista:seller>
<detallista:shipTo>
<detallista:gln>3210987654321</detallista:gln>
<detallista:nameAndAddress>
<detallista:name>Robles</detallista:name>
<detallista:streetAddressOne>Chalco</detallista:streetAddressOne>
<detallista:city>Edomex</detallista:city>
<detallista:postalCode>06060</detallista:postalCode>
</detallista:nameAndAddress>
</detallista:shipTo>
<detallista:currency currencyISOCode="MXN">
<detallista:currencyFunction>BILLING_CURRENCY</detallista:currencyFunction>
<detallista:rateOfChange>1.000000</detallista:rateOfChange>
</detallista:currency>
<detallista:allowanceCharge allowanceChargeType="ALLOWANCE_GLOBAL" settlementType="BILL_BACK">
<detallista:specialServicesType>AJ</detallista:specialServicesType>
<detallista:monetaryAmountOrPercentage>
<detallista:rate base="INVOICE_VALUE">
<detallista:percentage>0.00</detallista:percentage>
</detallista:rate>
</detallista:monetaryAmountOrPercentage>
</detallista:allowanceCharge>
<detallista:lineItem type="SimpleInvoiceLineItemType" number="1">
<detallista:tradeItemIdentification>
<detallista:gtin>00000</detallista:gtin>
</detallista:tradeItemIdentification>
<detallista:alternateTradeItemIdentification type="BUYER_ASSIGNED">00000</detallista:alternateTradeItemIdentification>
<detallista:tradeItemDescriptionInformation language="ES">
<detallista:longText>Concepto de prueba</detallista:longText>
</detallista:tradeItemDescriptionInformation>
<detallista:invoicedQuantity unitOfMeasure="NA">1.000000</detallista:invoicedQuantity>
<detallista:grossPrice>
<detallista:Amount>100.000000</detallista:Amount>
</detallista:grossPrice>
<detallista:netPrice>
<detallista:Amount>100.000000</detallista:Amount>
</detallista:netPrice>
<detallista:palletInformation>
<detallista:palletQuantity>20</detallista:palletQuantity>
<detallista:description type="CASE">Paquete 1</detallista:description>
<detallista:transport>
<detallista:methodOfPayment>PREPAID_BY_SELLER</detallista:methodOfPayment>
</detallista:transport>
</detallista:palletInformation>
<detallista:totalLineAmount>
<detallista:grossAmount>
<detallista:Amount>100.00</detallista:Amount>
</detallista:grossAmount>
<detallista:netAmount>
<detallista:Amount>100.00</detallista:Amount>
</detallista:netAmount>
</detallista:totalLineAmount>
</detallista:lineItem>
<detallista:lineItem type="SimpleInvoiceLineItemType" number="2">
<detallista:tradeItemIdentification>
<detallista:gtin>00000</detallista:gtin>
</detallista:tradeItemIdentification>
<detallista:alternateTradeItemIdentification type="BUYER_ASSIGNED">00000</detallista:alternateTradeItemIdentification>
<detallista:tradeItemDescriptionInformation language="ES">
<detallista:longText>Concepto de prueba</detallista:longText>
</detallista:tradeItemDescriptionInformation>
<detallista:invoicedQuantity unitOfMeasure="NA">1.000000</detallista:invoicedQuantity>
<detallista:grossPrice>
<detallista:Amount>105.000000</detallista:Amount>
</detallista:grossPrice>
<detallista:netPrice>
<detallista:Amount>105.000000</detallista:Amount>
</detallista:netPrice>
<detallista:palletInformation>
<detallista:palletQuantity>30</detallista:palletQuantity>
<detallista:description type="EXCHANGE_PALLETS">paque 2</detallista:description>
<detallista:transport>
<detallista:methodOfPayment>PAID_BY_BUYER</detallista:methodOfPayment>
</detallista:transport>
</detallista:palletInformation>
<detallista:totalLineAmount>
<detallista:grossAmount>
<detallista:Amount>105.00</detallista:Amount>
</detallista:grossAmount>
<detallista:netAmount>
<detallista:Amount>105.00</detallista:Amount>
</detallista:netAmount>
</detallista:totalLineAmount>
</detallista:lineItem>
<detallista:totalAmount>
<detallista:Amount>205.00</detallista:Amount>
</detallista:totalAmount>
<detallista:TotalAllowanceCharge allowanceOrChargeType="ALLOWANCE">
<detallista:specialServicesType>AJ</detallista:specialServicesType>
<detallista:Amount>0.00</detallista:Amount>
</detallista:TotalAllowanceCharge>
</detallista:detallista>
<tfd:TimbreFiscalDigital xmlns:tfd="http://www.sat.gob.mx/TimbreFiscalDigital" xsi:schemaLocation="http://www.sat.gob.mx/TimbreFiscalDigital http://www.sat.gob.mx/sitio_internet/TimbreFiscalDigital/TimbreFiscalDigital.xsd" selloCFD="x8SOr3nOGc5kyRXGD92vo+s8LVbFvFYM/HssokRCE3/T62Lu7SpT0CMfshFAL2eFRgn6dAl2iTMU5s3jx2T2WsxoJudDidxFHKibCvB0o+4OAMTnn5IzdJ3vxZ2hQtenWmkxYxq0PR9Dmi8K4/ZIRa+6fA8HKUyC5DnNynayvaI=" UUID="3ED00B53-365D-401F-92DA-1849CDE8F7A4" version="1.0" FechaTimbrado="2016-03-11T17:39:07" selloSAT="yNxm2+bmRHldG6GGZfaA1E6J6/AaTNcmRel7excMN6iUZga73fpUAiqJG5ioLvbDcDwas+I9nKIQ1a42m38MHonxsu9IvGJJ2YdSBlRlvJPn3l00hvQzq8mrDVMIUCwf4zkA6HX9zwVgS/ju6BoXSm+zS8+al+EfupvpF2OwgXM=" noCertificadoSAT="20001000000100005761"/>
</Complemento>
</Comprobante>
</dig:SET_DIGITAL_INVOICE_REQUEST>
</soap:Body>
</soap:Envelope>
Mil gracias.