LOCAL loXml
LOCAL lcSoapRequestBody
LOCAL lcEndpoint
LOCAL lcSoapAction
LOCAL lcContentType
LOCAL loHttp
LOCAL loResp
LOCAL loResponseXml
LOCAL lnStatusCode
LOCAL lcMensaje
LOCAL lnStatus
LOCAL lcStatusUUID
LOCAL lcUuid
loXml = CreateObject('Chilkat_9_5_0.Xml')
loXml.Tag = "soapenv:Envelope"
loXml.AddAttribute("xmlns:ns","http://timbrado.ws.cfdi.solucionfactible.com")
loXml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
loXml.UpdateChildContent("soapenv:Header","")
loXml.UpdateChildContent("soapenv:Body|ns:cancelar|ns:usuario","string")
loXml.UpdateChildContent("soapenv:Body|ns:cancelar|ns:password","string")
loXml.UpdateChildContent("soapenv:Body|ns:cancelar|ns:uuids","string")
loXml.UpdateChildContent("soapenv:Body|ns:cancelar|ns:derCertCSD","BqozVXeZZg==")
loXml.UpdateChildContent("soapenv:Body|ns:cancelar|ns:derKeyCSD","BqozVXeZZg==")
loXml.UpdateChildContent("soapenv:Body|ns:cancelar|ns:contrasenaCSD","string")
* 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://testing.solucionfactible.com/ws/services/Timbrado.TimbradoHttpsSoap11Endpoint/"
lcSoapAction = "urn:cancelar"* 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).
lcMensaje = loResponseXml.GetChildContent("*:Body|*:cancelarResponse|*:return|*:mensaje")
lcMensaje = loResponseXml.GetChildContent("*:Body|*:cancelarResponse|*:return|*:resultados|*:mensaje")
lnStatus = loResponseXml.GetChildIntValue("*:Body|*:cancelarResponse|*:return|*:resultados|*:status")
lcStatusUUID = loResponseXml.GetChildContent("*:Body|*:cancelarResponse|*:return|*:resultados|*:statusUUID")
lcUuid = loResponseXml.GetChildContent("*:Body|*:cancelarResponse|*:return|*:resultados|*:uuid")
lnStatus = loResponseXml.GetChildIntValue("*:Body|*:cancelarResponse|*:return|*:status")
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml