LOCAL loXml
LOCAL lcSoapRequestBody
LOCAL lcEndpoint
LOCAL lcSoapAction
LOCAL lcContentType
LOCAL loHttp
LOCAL loResp
LOCAL loResponseXml
LOCAL lnStatusCode
LOCAL lcEnvelope_xmlns
LOCAL lcConfirmaCancelamentoLote_versao
LOCAL lcCNPJ
LOCAL lcCLote
LOCAL lcDhRecbto
LOCAL lcSit
LOCAL lcMot
LOCAL lcSignature_Id
LOCAL lcSignedInfo_Id
LOCAL lcCanonicalizationMethod_Algorithm
LOCAL lcSignatureMethod_Algorithm
LOCAL lcReference_Id
LOCAL lcReference_URI
LOCAL lcReference_Type
LOCAL lcTransform_Algorithm
LOCAL lcXPath
LOCAL lcDigestMethod_Algorithm
LOCAL lcDigestValue
LOCAL lcSignatureValue
LOCAL lcKeyInfo_Id
LOCAL lcX509SubjectName
LOCAL lcX509Certificate
loXml = CreateObject('Chilkat_9_5_0.Xml')
loXml.Tag = "soapenv:Envelope"
loXml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
loXml.AddAttribute("xmlns","http://ws.pc.gif.com.br/")
loXml.AddAttribute("xmlns:nfs","http://nfse.abrasf.org.br")
loXml.AddAttribute("xmlns:ds","http://www.w3.org/2000/09/xmldsig#")
loXml.UpdateChildContent("soapenv:Header","")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote",1,"versao","?")
loXml.UpdateChildContent("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|CNPJ","token string")
loXml.UpdateChildContent("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|cLote","string")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature",1,"Id","?")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo",1,"Id","?")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:CanonicalizationMethod",1,"Algorithm","http://www.w3.org/TR/2001/REC-xml-c14n-20010315")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:SignatureMethod",1,"Algorithm","http://www.w3.org/2000/09/xmldsig#rsa-sha1")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference",1,"Id","?")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference",1,"URI","?")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference",1,"Type","?")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform",1,"Algorithm","?")
loXml.UpdateChildContent("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform|ds:XPath","string")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestMethod",1,"Algorithm","http://www.w3.org/2000/09/xmldsig#sha1")
loXml.UpdateChildContent("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestValue","BASE64_DATA")
loXml.UpdateChildContent("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignatureValue","...")
loXml.UpdateAttrAt("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo",1,"Id","?")
loXml.UpdateChildContent("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509SubjectName","string")
loXml.UpdateChildContent("soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509Certificate","BqozVXeZZg==")
* 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://canoas-homol.infisc.com.br/services/nfse/ws/Servicos"
lcSoapAction = ""* For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
lcContentType = "text/xml"
loHttp = CreateObject('Chilkat_9_5_0.Http')
loHttp.ClearHeaders()
loHttp.SetRequestHeader("Content-Type",lcContentType)
loHttp.SetRequestHeader("SOAPAction",lcSoapAction)
loResp = loHttp.PostXml(lcEndpoint,lcSoapRequestBody,"utf-8")
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
? "Failed to send SOAP request."RELEASE loXml
RELEASE loHttp
CANCELENDIF* Get the XML response body.
loResponseXml = CreateObject('Chilkat_9_5_0.Xml')
loResp.GetBodyXml(loResponseXml)
lnStatusCode = loResp.StatusCode
? "response status code: " + STR(lnStatusCode)
RELEASE loResp
* If the status code does not indicate succcess, then show the response XML,
* which probably contains error information.IF (lnStatusCode <> 200) THEN
? loResponseXml.GetXml()
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml
CANCELENDIF
? loResponseXml.GetXml()
* 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).
lcEnvelope_xmlns = loResponseXml.GetAttrValue("xmlns")
lcConfirmaCancelamentoLote_versao = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|(versao)")
lcCNPJ = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|CNPJ")
lcCLote = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|cLote")
lcDhRecbto = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|dhRecbto")
lcSit = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|sit")
lcMot = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|mot")
lcSignature_Id = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|(Id)")
lcSignedInfo_Id = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|(Id)")
lcCanonicalizationMethod_Algorithm = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:CanonicalizationMethod|(Algorithm)")
lcSignatureMethod_Algorithm = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:SignatureMethod|(Algorithm)")
lcReference_Id = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Id)")
lcReference_URI = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(URI)")
lcReference_Type = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Type)")
lcTransform_Algorithm = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|(Algorithm)")
lcXPath = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|*:XPath")
lcDigestMethod_Algorithm = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestMethod|(Algorithm)")
lcDigestValue = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestValue")
lcSignatureValue = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignatureValue")
lcKeyInfo_Id = loResponseXml.ChilkatPath("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|(Id)")
lcX509SubjectName = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|*:X509Data|*:X509SubjectName")
lcX509Certificate = loResponseXml.GetChildContent("*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|*:X509Data|*:X509Certificate")
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml