Re: LIB CURL + HARBOUR + BCC 7.7
Posted: Wed Mar 19, 2025 5:30 pm
le agregue el archivo firmado... y responde con "0" y vacio el response
www.FiveTechSoft.com
https://forums.fivetechsupport.com/~fivetec1/forums/
https://forums.fivetechsupport.com/~fivetec1/forums/viewtopic.php?t=45530
Code: Select all | Expand
#include "hbcurl.ch"
PROCEDURE main()
local nError, cResponse
//local cXmlStr := hb_memoread( "peticion.xml" )
local aHeader := {}
local cUrl := "https://vpfe.dian.gov.co/WcfDianCustomerServices.svc"
local cCertFile := "CERTIFICADO.p12"
local cCertType := "P12" // o "PFX"
local cCertPass := "xxxxxxxxx"
local cNomZip := "z006331767200025SP104100000250.zip"
local cFacturaXml,cXmlStr := ""
local aHasRes := hash()
local cFilRes := ""
local cSignedXmlFile := "E:\TEMP\XML_FIRMADO\z006331767200025SP104100000250_fv_B64"
local hCurl
cFacturaXml = MemoRead( cSignedXmlFile )
// cFacturaXml := "UEsDBBQAAgAIABxKZ1obwE1WRBYAAGlGAAAjAAAAZnYwMDYzMzE3NjcyMDAwMjVTUDEwNDEwMDAwMDI1MC54bWztPNtyo0qS7xMx/6DwedkNHVncJMDR9iwgJCELJATo9salQEjcDEhI+pv9hvmE+bEtQFdbard7pifO7h5HdBiyMrPyVplZVLm//W3re5UNiBM3DJ4f0EfkoQICM7TcwHl+WKd2jXqoJKkeWLoXBuD5IQgf/vby1798E4JN6JqgAsmDBGLGwVOoJ27yFOg+SJ6SCJiu7Zp6Cvk+rQ3vKTEXwNefton1dKCtYQ8l+ZOpm19kwYW+HwaM48TA0VMAXyMoXpAmF0yNn2PKQnTzFkML6rlI0+ipXs+y7DHDH8PYqWMIgtQRug5xrMR1fjtig236U9Pz2xQEuTduiZCkUAbL1YMnJ9w8meGTrZvpOtaBB8w0DgPI+UlJ43UOBJCuhh4pt7oFzvKvY/cRpIlbaICgNILXN+gj/oj9doWPEugnJMQjeiZJ3DsGQutTsa8UmtbcIA8nE0CqxD2o3w9Li/xsHFXyn8PMVmgm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WFlM/Y/Vfv0/CYt/ZTeT93kEgSI09XPdjOu7Zhz+873Mye8gTm63BW03LgP/6OZyojP4Fo3uu15ZmD7ExMXYDUrRtSwPlEeZ9XeAj664FvrTvuxG13UI+l3+yVcE+uWfGh+W48fPouV+/IKmWPfHw4D38FtU9z58vxu+UOKjiIXkRRyKMGxSPd6pYap71/Plte909sL4uR0q5uHLdr4QuMHwAfb7j8ev9DfwrxnCzMFvTW+duBtwj9+Z3UfsD9yE4BNu6BW7d+gfrKsbHhjBkfwI7XP5bhLc5PkD0l1hXvrunpMKDx5OMK6alGPoobdD70BiyTDH5Rmosg7cNI+154f8HBI9SfQe8VfGRq5KCvzrxJKfp5xP018UfjQWOGFQYRRBUXmJE5jKWBipGtM/HL5cIL/PUErxf2HEVj7LFzYzuSY0TV8nfD5J//HfObe8buhWGB2LiFcx87/bdo31Ds4AHmDDPL6/H/kxkY6t72HrliMfDl13dw5k7u0HLrbo9xuAHH74C6UwSNZ+mOv4VGkDI3/IM05JW+J80OlzQb+uD/apPtiP6HM8moMVvixzz7DMwZenCvLPqFQiXQVvWRVi1wQf4rmA/kg2OON94MHqCfh08V4ivS9xZ8kOwl8lkW/1wzt8/utf/gdQSwECFAAUAAIACAAcSmdaG8BNVkQWAABpRgAAIwAAAAAAAAAAACAAtIEAAAAAZnYwMDYzMzE3NjcyMDAwMjVTUDEwNDEwMDAwMDI1MC54bWxQSwUGAAAAAAEAAQBRAAAAhRYAAAAA"
// Crear la solicitud SOAP
cXmlStr := ;
'<?xml version="1.0" encoding="UTF-8"?>' + ;
'<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wcf="http://wcf.dian.colombia">' + ;
'<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsse:Security soap:mustUnderstand="true" 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"><wsu:Timestamp wsu:Id="TS-BD40368ECABC33A9ED174242532066842"><wsu:Created>2025-03-19T23:02:00.668Z</wsu:Created><wsu:Expires>2025-03-20T15:42:00.668Z</wsu:Expires></wsu:Timestamp><wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-BD40368ECABC33A9ED174242532063237">MIIHCDCCBfCgAwIBAgIIK+IT003JoQUwDQYJKoZIhvcNAQELBQAwgcUxJjAkBgNVBAMMHVNVQkNBIENBTUVSRklSTUEgQ09MT01CSUEgU0FTMRQwEgYDVQQFEws5MDEzMTIxMTItNDFAMD4GA1UECww3Q2VydGlmaWNhZG9zIFBhcmEgRmlybWEgRWxlY3Ryb25pY2EgQ2FtZXJmaXJtYSBDb2xvbWJpYTEgMB4GA1UECgwXQ0FNRVJGSVJNQSBDT0xPTUJJQSBTQVMxFDASBgNVBAcMC0JPR09UQSBELkMuMQswCQYDVQQGEwJDTzAeFw0yNDA3MjQxMzU4MzZaFw0yNjA3MjQxMzU4MzVaMIHLMRwwGgYDVQQJDBNDUkEgMzYgNDQgMzUgT0YgODAzMRMwEQYDVQQUEwozMTY1MjI5NTI4MSAwHgYDVQQDDBdNQVJUSEEgQ0FTVElMTE8gRlVFTlRFUzERMA8GA1UEBRMINjMzMTc2NzIxHDAaBgNVBAsME0ZhY3R1cmEgZWxlY3Ryb25pY2ExIDAeBgNVBAoMF01BUlRIQSBDQVNUSUxMTyBGVUVOVEVTMRQwEgYDVQQIDAtCdWNhcmFtYW5nYTELMAkGA1UEBhMCQ08wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCW4HEbz3N/QWH/5PrCol8/etMgghJizecnQbod7qY++ZKUPGKW1GUqsBIesoZ276W5UPPqtnCnc4zYKori/6SmrF7hthv7VpzWugdaULzQ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AMD4GA1UECww3Q2VydGlmaWNhZG9zIFBhcmEgRmlybWEgRWxlY3Ryb25pY2EgQ2FtZXJmaXJtYSBDb2xvbWJpYTEUMBIGA1UEBRMLOTAxMzEyMTEyLTQwHQYDVR0OBBYEFCJbrc3C7Y95FmzhU4xYMe8hb39tMA4GA1UdDwEB/wQEAwIF4DANBgkqhkiG9w0BAQsFAAOCAQEArsRQuXwBM6SOohj2vQ6XLoMmdn83vEkQN/NZ7NBpMHI0+Im+ij3mQxYcPJET6X2qljVt8v+dC4eNeANQ+cWTIzDcBuxnjIMFpHTchCGVPC1/XENLr66Ly+wXurDNBA5Zo2I4VATkIEG6d39PuM4SSmz+ZrGjiOz+A0FfQsq6wP+fp9TLHphR8U4wfk87NKLl8H1Vafo7YX7Fz9WCPeYMEjeeyiBEhdoXS/v7l1PEj7JfYodSJO/YhNJzcla6EAp63BV/JPMTQaOBlzp1SL8+YHDTUekIbMpL5iByY9KL/ooQvZm+R0rcvaAJCCgogmcytUj4LK9plcOiIgtpg3gVtQ==</wsse:BinarySecurityToken><ds:Signature Id="SIG-BD40368ECABC33A9ED174242532066441" xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="wsa soap wcf" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI="#id-BD40368ECABC33A9ED174242532063240"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces PrefixList="soap wcf" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>qJh6cLlCnqq3wbelPQpLrHWjF1DckDtAd6nImSnuk0A=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>QfUTEIbjYSlsBrTjWPwzciZvY/je5La75j8yZrRhxUDHqYHt/09erTS6o6Cd8kMFg4cLoleY1VF1P0xiFMLJCIQYvb9TKYmQPuV2y4vw2B7fAkKNRxSW5JRjeIaAWN3WZ3XjIZiKZMzNKXKVLuM6hKNQ1mtnKBHqc3QpRikmekRwpJ7hDACB+LCbwHQywG9aAdaKzELHO3zzc1khju1YvcRb+eN9Dll7I0CVSX7RUklUfdUtdcyumZPmsgRmPMAZp0PG9owrbOd24tLKDD8QJQM9duNrv+EghPzsBmhYe70CzVlJ7Q3JtiWPctn6O5+Skb2DIsSuyJ6+wkyMNXfdVQ==</ds:SignatureValue><ds:KeyInfo Id="KI-BD40368ECABC33A9ED174242532063238"><wsse:SecurityTokenReference wsu:Id="STR-BD40368ECABC33A9ED174242532063239"><wsse:Reference URI="#X509-BD40368ECABC33A9ED174242532063237" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/></wsse:SecurityTokenReference></ds:KeyInfo></ds:Signature></wsse:Security><wsa:Action>http://wcf.dian.colombia/IWcfDianCustomerServices/SendBillSync</wsa:Action><wsa:To wsu:Id="id-BD40368ECABC33A9ED174242532063240" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">https://vpfe.dian.gov.co/WcfDianCustomerServices.svc</wsa:To></soap:Header>'+;
'<soap:Body>' + ;
'<wcf:SendBillSync>' + ;
'<wcf:fileName>' + cNomZip +'</wcf:fileName>' + ;
'<wcf:contentFile>' + cFacturaXml + '</wcf:contentFile>' + ;
'</wcf:SendBillSync>' + ;
'</soap:Body>' + ;
'</soap:Envelope>'
// HB_MEMOWRIT( "PRUEBA.XML", cXmlStr )
// Establecer cabeceras requeridas por el WS
aadd( aHeader, "Content-Type: application/soap+xml; charset=UTF-8" )
aadd( aHeader, "SOAPaction=http://wcf.dian.colombia/IWcfDianCustomerServices/SendBillSync" )
aadd( aHeader, "Connection: Keep-Alive" )
aadd( aHeader, "Cache-Control: private" )
hCurl := curl_easy_init()
curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )
curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYPEER, .f. )
curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYHOST, .f. )
curl_easy_setopt( hCurl, HB_CURLOPT_SSLCERT, cCertFile )
curl_easy_setopt( hCurl, HB_CURLOPT_SSLCERTTYPE, cCertType )
curl_easy_setopt( hCurl, HB_CURLOPT_KEYPASSWD, cCertPass )
curl_easy_setopt( hCurl, HB_CURLOPT_POSTFIELDS, cXmlStr )
curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )
curl_easy_setopt( hCurl, HB_CURLOPT_HTTPHEADER, aHeader )
// echo server, para depurar .T.
curl_easy_setopt( hCurl, HB_CURLOPT_VERBOSE, .T. )
curl_easy_setopt( hCurl, HB_CURLOPT_ENCODING, "" )
curl_easy_setopt( hCurl, HB_CURLOPT_MAXREDIRS, 10 )
curl_easy_setopt( hCurl, HB_CURLOPT_CUSTOMREQUEST, "POST" )
// No reutilizar conexiones
curl_easy_setopt( hCurl, HB_CURLOPT_FRESH_CONNECT, .T.)
curl_easy_setopt( hCurl, HB_CURLOPT_FORBID_REUSE, .T.)
// Conexion
nError := curl_easy_perform( hCurl )
cResponse := curl_easy_dl_buff_get( hCurl )
if nError == 0
hb_memowrit( "respuesta.xml", cResponse )
else
MSGINFO( curl_easy_strerror( nError ) )
endif
curl_easy_cleanup( hCurl )
curl_global_cleanup()
return
Code: Select all | Expand
<soap:Header
xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsse:Security soap:mustUnderstand="true"
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">
<wsu:Timestamp wsu:Id="TS-938EB38DEFEBD26652174243018444012">
<wsu:Created>2025-03-20T00:23:04.440Z</wsu:Created>
<wsu:Expires>2025-03-20T17:03:04.440Z</wsu:Expires>
</wsu:Timestamp>
<wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-938EB38DEFEBD2665217424301843837">MIIHCDCCBfCgAwIBAgIIK+IT003JoQUwDQYJKoZIhvcNAQELBQAwgcUxJjAkBgNVBAMMHVNVQkNBIENBTUVSRklSTUEgQ09MT01CSUEgU0FTMRQwEgYDVQQFEws5MDEzMTIxMTItNDFAMD4GA1UECww3Q2VydGlmaWNhZG9zIFBhcmEgRmlybWEgRWxlY3Ryb25pY2EgQ2FtZXJmaXJtYSBDb2xvbWJpYTEgMB4GA1UECgwXQ0FNRVJGSVJNQSBDT0xPTUJJQSBTQVMxFDASBgNVBAcMC0JPR09UQSBELkMuMQswCQYDVQQGEwJDTzAeFw0yNDA3MjQxMzU4MzZaFw0yNjA3MjQxMzU4MzVaMIHLMRwwGgYDVQQJDBNDUkEgMzYgNDQgMzUgT0YgODAzMRMwEQYDVQQUEwozMTY1MjI5NTI4MSAwHgYDVQQDDBdNQVJUSEEgQ0FTVElMTE8gRlVFTlRFUzERMA8GA1UEBRMINjMzMTc2NzIxHDAaBgNVBAsME0ZhY3R1cmEgZWxlY3Ryb25pY2ExIDAeBgNVBAoMF01BUlRIQSBDQVNUSUxMTyBGVUVOVEVTMRQwEgYDVQQIDAtCdWNhcmFtYW5nYTELMAkGA1UEBhMCQ08wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCW4HEbz3N/QWH/5PrCol8/etMgghJizecnQbod7qY++ZKUPGKW1GUqsBIesoZ276W5UPPqtnCnc4zYKori/6SmrF7hthv7VpzWugdaULz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FAMD4GA1UECww3Q2VydGlmaWNhZG9zIFBhcmEgRmlybWEgRWxlY3Ryb25pY2EgQ2FtZXJmaXJtYSBDb2xvbWJpYTEUMBIGA1UEBRMLOTAxMzEyMTEyLTQwHQYDVR0OBBYEFCJbrc3C7Y95FmzhU4xYMe8hb39tMA4GA1UdDwEB/wQEAwIF4DANBgkqhkiG9w0BAQsFAAOCAQEArsRQuXwBM6SOohj2vQ6XLoMmdn83vEkQN/NZ7NBpMHI0+Im+ij3mQxYcPJET6X2qljVt8v+dC4eNeANQ+cWTIzDcBuxnjIMFpHTchCGVPC1/XENLr66Ly+wXurDNBA5Zo2I4VATkIEG6d39PuM4SSmz+ZrGjiOz+A0FfQsq6wP+fp9TLHphR8U4wfk87NKLl8H1Vafo7YX7Fz9WCPeYMEjeeyiBEhdoXS/v7l1PEj7JfYodSJO/YhNJzcla6EAp63BV/JPMTQaOBlzp1SL8+YHDTUekIbMpL5iByY9KL/ooQvZm+R0rcvaAJCCgogmcytUj4LK9plcOiIgtpg3gVtQ==</wsse:BinarySecurityToken>
<ds:Signature Id="SIG-938EB38DEFEBD26652174243018442611"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces PrefixList="wsa soap wcf"
xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference URI="#id-938EB38DEFEBD26652174243018438610">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces PrefixList="soap wcf"
xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>buQfAhluXZsKUO9HlDLCSFgl0MeGNpeG7bWGlApVNL8=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>GMgcY6ADnFAlGnWNQqOsOOQDd+WicYhZwabfkWsZlcNiUacKLvpr7+K1akLjls7ZaP6XNj/3LwQOcFWB+it5rwuVbyC7DMGNYDMVih99dz6HiChUggeTZdDO7t+G2e/VHr+BQobqsrhn1Pj4X/WbFu+MFPtwRralxyZvCe/SamkidyQb2aNyXXI6PHZsW507o7aGmAF/MFYAk4b/8xf6QXYnRrkYUWoAsOjAO2vzILl8Lk7ppBCbYa6Q4AUzdsCnDqr9iKgC+nXw40gQ0Q/EeOzV/oSQ9VQDkLcDrYvWG8hsjFYBmF4F+AGfwC5yovuljrvDM82sG+D3yNMcLv+Ofg==</ds:SignatureValue>
<ds:KeyInfo Id="KI-938EB38DEFEBD2665217424301843858">
<wsse:SecurityTokenReference wsu:Id="STR-938EB38DEFEBD2665217424301843859">
<wsse:Reference URI="#X509-938EB38DEFEBD2665217424301843837" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature>
</wsse:Security>
<wsa:Action>http://wcf.dian.colombia/IWcfDianCustomerServices/SendBillSync</wsa:Action>
<wsa:To wsu:Id="id-938EB38DEFEBD26652174243018438610"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">https://vpfe.dian.gov.co/WcfDianCustomerServices.svc
</wsa:To>
</soap:Header>
Code: Select all | Expand
FUNCTION CLILKAT(cFilNam, xDocB64)
LOCAL loXml
LOCAL lcSoapRequestBody
LOCAL lcEndpoint
LOCAL lcSoapAction
LOCAL lcContentType
LOCAL loHttp
LOCAL loResp
LOCAL loResponseXml
LOCAL lnStatusCode
LOCAL lcV_string
LOCAL lcIsValid
LOCAL lcStatusCode
LOCAL lcStatusDescription
LOCAL lcStatusMessage
LOCAL lcXmlBase64Bytes
LOCAL lcXmlBytes
LOCAL lcXmlDocumentKey
LOCAL lcXmlFileName
local cFilXml
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Xml')
loXml = CreateObject('Chilkat.Xml')
loXml:Tag = "soap:Envelope"
loXml:AddAttribute("xmlns:soap","http://www.w3.org/2003/05/soap-envelope")
loXml:AddAttribute("xmlns:wcf","http://wcf.dian.colombia")
loXml:UpdateChildContent("soap:Header","")
loXml:UpdateChildContent("soap:Body|wcf:SendBillSync|wcf:fileName",cFilNam)
loXml:UpdateChildContent("soap:Body|wcf:SendBillSync|wcf:contentFile",xDocB64)
* In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required.
loXml:EmitXmlDecl = 0
lcSoapRequestBody = loXml:GetXml()
lcEndpoint = "https://vpfe-hab.dian.gov.co/WcfDianCustomerServices.svc"
lcSoapAction = "http://wcf.dian.colombia/IWcfDianCustomerServices/SendBillSync"
* For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
lcContentType = "application/soap+xml"
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
loHttp:ClearHeaders()
loHttp:SetRequestHeader("Content-Type",lcContentType)
loHttp:SetRequestHeader("SOAPAction",lcSoapAction)
loResp = loHttp:PostXml(lcEndpoint,lcSoapRequestBody,"utf-8")
IF (loHttp:LastMethodSuccess = 0)
alert( loHttp:LastErrorText)
alert( "Failed to send SOAP request." )
RELEASE loXml
RELEASE loHttp
CANCEL
ENDIF
* Get the XML response body.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Xml')
loResponseXml = CreateObject('Chilkat.Xml')
loResp:GetBodyXml(loResponseXml)
lnStatusCode = loResp:StatusCode
alert( "response status code: " + STR(lnStatusCode) )
RELEASE loResp
cFilXml := loResponseXml:GetXml()
hb_memowrit( "respuestaCli.xml", cFilXml )
* If the status code does not indicate succcess, then show the response XML,
* which probably contains error information.
IF (lnStatusCode <> 200)
alert( cFilXml )
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml
CANCEL
ENDIF
* Parse the successful SOAP response XML.
* This is a sample of the response XML, but the namespace prefixes will be different.
* We can parse the result using "*" for the namespace prefixes (see below).
lcV_string = loResponseXml:GetChildContent("*:Body|*:SendBillSyncResponse|*:SendBillSyncResult|*:ErrorMessage|*:string")
lcIsValid = loResponseXml:GetChildContent("*:Body|*:SendBillSyncResponse|*:SendBillSyncResult|*:IsValid")
lcStatusCode = loResponseXml:GetChildContent("*:Body|*:SendBillSyncResponse|*:SendBillSyncResult|*:StatusCode")
lcStatusDescription = loResponseXml:GetChildContent("*:Body|*:SendBillSyncResponse|*:SendBillSyncResult|*:StatusDescription")
lcStatusMessage = loResponseXml:GetChildContent("*:Body|*:SendBillSyncResponse|*:SendBillSyncResult|*:StatusMessage")
lcXmlBase64Bytes = loResponseXml:GetChildContent("*:Body|*:SendBillSyncResponse|*:SendBillSyncResult|*:XmlBase64Bytes")
lcXmlBytes = loResponseXml:GetChildContent("*:Body|*:SendBillSyncResponse|*:SendBillSyncResult|*:XmlBytes")
lcXmlDocumentKey = loResponseXml:GetChildContent("*:Body|*:SendBillSyncResponse|*:SendBillSyncResult|*:XmlDocumentKey")
lcXmlFileName = loResponseXml:GetChildContent("*:Body|*:SendBillSyncResponse|*:SendBillSyncResult|*:XmlFileName")
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml
RETURN cFilXml
Hola a todos,russimicro wrote: Fri Mar 21, 2025 11:43 am Buen día...
Estuve trabajando el ActiveX de CHILKAT y ya logre los 4 procesos críticos para enviar facturas electrónicas a la DIAN Colombia
1. Creación de XML
2. Firmar XML : INVOICE, CREDITNOTE, ETC
3. Firmar XML de petición o ejecución de WS DIAN
4. Envió de petición o ejecución de WS DIAN (para no usar LIBCURL)