$oXml = ObjCreate("Chilkat_9_5_0.Xml")
$oXml.Tag = "soapenv:Envelope"
$oXml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
$oXml.AddAttribute("xmlns:ds","http://www.w3.org/2000/09/xmldsig#")
$oXml.AddAttribute("xmlns:sfLR","https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd")
$oXml.AddAttribute("xmlns:sf","https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd")
$oXml.UpdateChildContent"soapenv:Header",""
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sf:Cabecera|sf:ObligadoEmision|sf:NombreRazon","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sf:Cabecera|sf:ObligadoEmision|sf:NIF","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sf:Cabecera|sf:RemisionVoluntaria|sf:FechaFinVeriFactu","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sf:Cabecera|sf:RemisionVoluntaria|sf:Incidencia","S"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sf:Cabecera|sf:RemisionRequerimiento|sf:RefRequerimiento","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:IDVersion","1.0"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:IDFactura|sf:IDEmisorFactura","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:IDFactura|sf:NumSerieFactura","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:IDFactura|sf:FechaExpedicionFactura","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:NombreRazonEmisor","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Subsanacion","S"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:RechazoPrevio","N"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:TipoFactura","F1"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:TipoRectificativa","S"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FacturasRectificadas|sf:IDFacturaRectificada|sf:IDEmisorFactura","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FacturasRectificadas|sf:IDFacturaRectificada|sf:NumSerieFactura","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FacturasRectificadas|sf:IDFacturaRectificada|sf:FechaExpedicionFactura","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FacturasSustituidas|sf:IDFacturasSustituida|sf:IDEmisorFactura","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FacturasSustituidas|sf:IDFacturasSustituida|sf:NumSerieFactura","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FacturasSustituidas|sf:IDFacturasSustituida|sf:FechaExpedicionFactura","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:ImporteRectificacion|sf:BaseRectificada","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:ImporteRectificacion|sf:CuotaRectificada","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:ImporteRectificacion|sf:CuotaRecargoRectificado","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FechaOperacion","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:DescripcionOperacion","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FacturaSimplificadaArt7273","S"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FacturaSinIdentifDestinatarioArt61d","S"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Macrodato","S"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:EmitidaPorTerceroODestinatario","D"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Tercero|sf:NombreRazon","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Tercero|sf:NIF","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Destinatarios|sf:IDDestinatario|sf:NombreRazon","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Destinatarios|sf:IDDestinatario|sf:NIF","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Cupon","S"
$oXml.UpdateChildContentInt"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Desglose|sf:DetalleDesglose|sf:ClaveRegimen",01
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Desglose|sf:DetalleDesglose|sf:CalificacionOperacion","S1"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Desglose|sf:DetalleDesglose|sf:TipoImpositivo","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Desglose|sf:DetalleDesglose|sf:BaseImponibleOimporteNoSujeto","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Desglose|sf:DetalleDesglose|sf:BaseImponibleACoste","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Desglose|sf:DetalleDesglose|sf:CuotaRepercutida","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Desglose|sf:DetalleDesglose|sf:TipoRecargoEquivalencia","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Desglose|sf:DetalleDesglose|sf:CuotaRecargoEquivalencia","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:CuotaTotal","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:ImporteTotal","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Encadenamiento",""
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:SistemaInformatico|sf:NombreRazon","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:SistemaInformatico|sf:NIF","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:SistemaInformatico|sf:NombreSistemaInformatico","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:SistemaInformatico|sf:IdSistemaInformatico","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:SistemaInformatico|sf:Version","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:SistemaInformatico|sf:NumeroInstalacion","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:SistemaInformatico|sf:TipoUsoPosibleSoloVerifactu","S"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:SistemaInformatico|sf:TipoUsoPosibleMultiOT","S"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:SistemaInformatico|sf:IndicadorMultiplesOT","S"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:FechaHoraHusoGenRegistro","dateTime"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:NumRegistroAcuerdoFacturacion","string"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:IdAcuerdoSistemaInformatico","string"
$oXml.UpdateChildContentInt"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:TipoHuella",01
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|sf:Huella","string"
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature",True,"Id","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo",True,"Id","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo|ds:CanonicalizationMethod",True,"Algorithm","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo|ds:SignatureMethod",True,"Algorithm","?")
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo|ds:SignatureMethod|ds:HMACOutputLength","integer"
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo|ds:Reference",True,"Id","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo|ds:Reference",True,"URI","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo|ds:Reference",True,"Type","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform",True,"Algorithm","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestMethod",True,"Algorithm","?")
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestValue","BASE64_DATA"
$oXml.UpdateChildContent"soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:SignatureValue","..."
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:KeyInfo",True,"Id","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:Object",True,"Id","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:Object",True,"MimeType","?")
$oXml.UpdateAttrAt("soapenv:Body|sfLR:RegFactuSistemaFacturacion|sfLR:RegistroFactura|sfLR:RegistroAlta|ds:Signature|ds:Object",True,"Encoding","?")
; In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required.
$oXml.EmitXmlDecl = FalseLocal $soapRequestBody = $oXml.GetXml()
Local $sEndpoint = "xxxxxxxxxx"Local $soapAction = ""; For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"Local $sContentType = "text/xml"
$oHttp = ObjCreate("Chilkat_9_5_0.Http")
$oHttp.ClearHeaders
$oHttp.SetRequestHeader"Content-Type",$sContentType
$oHttp.SetRequestHeader"SOAPAction",$soapAction
Local $oResp = $oHttp.PostXml($sEndpoint,$soapRequestBody,"utf-8")
If ($oHttp.LastMethodSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
ConsoleWrite("Failed to send SOAP request." & @CRLF)
Exit
EndIf; Get the XML response body.
$oResponseXml = ObjCreate("Chilkat_9_5_0.Xml")
$oResp.GetBodyXml($oResponseXml)
Local $iStatusCode = $oResp.StatusCode
ConsoleWrite("response status code: " & $iStatusCode & @CRLF)
; If the status code does not indicate succcess, then show the response XML,
; which probably contains error information.If ($iStatusCode <> 200) Then
ConsoleWrite($oResponseXml.GetXml() & @CRLF)
Exit
EndIf
ConsoleWrite($oResponseXml.GetXml() & @CRLF)
; 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).Local $sCSV = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:CSV")
Local $sNIFPresentador = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:DatosPresentacion|*:NIFPresentador")
Local $sTimestampPresentacion = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:DatosPresentacion|*:TimestampPresentacion")
Local $sNombreRazon = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:Cabecera|*:ObligadoEmision|*:NombreRazon")
Local $sNIF = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:Cabecera|*:ObligadoEmision|*:NIF")
Local $sFechaFinVeriFactu = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:Cabecera|*:RemisionVoluntaria|*:FechaFinVeriFactu")
Local $sIncidencia = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:Cabecera|*:RemisionVoluntaria|*:Incidencia")
Local $sRefRequerimiento = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:Cabecera|*:RemisionRequerimiento|*:RefRequerimiento")
Local $sTiempoEsperaEnvio = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:TiempoEsperaEnvio")
Local $sEstadoEnvio = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:EstadoEnvio")
Local $sIDEmisorFactura = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:RespuestaLinea|*:IDFactura|*:IDEmisorFactura")
Local $sNumSerieFactura = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:RespuestaLinea|*:IDFactura|*:NumSerieFactura")
Local $sFechaExpedicionFactura = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:RespuestaLinea|*:IDFactura|*:FechaExpedicionFactura")
Local $sEstadoRegistro = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:RespuestaLinea|*:EstadoRegistro")
Local $sCodigoErrorRegistro = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:RespuestaLinea|*:CodigoErrorRegistro")
Local $sDescripcionErrorRegistro = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:RespuestaLinea|*:DescripcionErrorRegistro")
Local $sCSVRegistroDuplicado = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:RespuestaLinea|*:CSVRegistroDuplicado")
Local $sEstadoRegistroDuplicado = $oResponseXml.GetChildContent("*:Body|*:RespuestaRegFactuSistemaFacturacion|*:RespuestaLinea|*:EstadoRegistroDuplicado")