$oXml = ObjCreate("Chilkat_9_5_0.Xml")
$oXml.Tag = "soap:Envelope"
$oXml.AddAttribute("xmlns:soap","http://www.w3.org/2003/05/soap-envelope")
$oXml.AddAttribute("xmlns:ar","http://ar.gov.afip.dif.FEV1/")
$oXml.UpdateChildContent"soap:Header",""
$oXml.UpdateChildContent"soap:Body|ar:FECompConsultar|ar:Auth|ar:Token","string"
$oXml.UpdateChildContent"soap:Body|ar:FECompConsultar|ar:Auth|ar:Sign","string"
$oXml.UpdateChildContentInt"soap:Body|ar:FECompConsultar|ar:Auth|ar:Cuit",123456
$oXml.UpdateChildContentInt"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteTipo",1042
$oXml.UpdateChildContentInt"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteNro",123456
$oXml.UpdateChildContentInt"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:PtoVta",1042; 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 = "https://wswhomo.afip.gov.ar/wsfev1/service.asmx"Local $soapAction = "http://ar.gov.afip.dif.FEV1/FECompConsultar"; 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 $iConcepto = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Concepto")
Local $iDocTipo = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocTipo")
Local $iDocNro = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocNro")
Local $iCbteDesde = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteDesde")
Local $iCbteHasta = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteHasta")
Local $sCbteFch = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteFch")
Local $sImpTotal = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotal")
Local $sImpTotConc = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotConc")
Local $sImpNeto = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpNeto")
Local $sImpOpEx = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpOpEx")
Local $sImpTrib = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTrib")
Local $sImpIVA = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpIVA")
Local $sFchServDesde = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServDesde")
Local $sFchServHasta = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServHasta")
Local $sFchVtoPago = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVtoPago")
Local $sMonId = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonId")
Local $sMonCotiz = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonCotiz")
Local $iTipo = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Tipo")
Local $iPtoVta = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:PtoVta")
Local $iNro = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Nro")
Local $sCuit = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Cuit")
$sCbteFch = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:CbteFch")
Local $iId = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Id")
Local $sDesc = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Desc")
Local $sBaseImp = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:BaseImp")
Local $sAlic = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Alic")
Local $sImporte = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Importe")
$iId = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:Id")
$sBaseImp = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:BaseImp")
$sImporte = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:Importe")
Local $strId = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Opcionales|*:Opcional|*:Id")
Local $sValor = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Opcionales|*:Opcional|*:Valor")
$iDocTipo = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:DocTipo")
$iDocNro = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:DocNro")
Local $sPorcentaje = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:Porcentaje")
Local $sFchDesde = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchDesde")
Local $sFchHasta = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchHasta")
$iId = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Actividades|*:Actividad|*:Id")
Local $sResultado = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Resultado")
Local $sCodAutorizacion = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CodAutorizacion")
Local $sEmisionTipo = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:EmisionTipo")
Local $sFchVto = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVto")
Local $sFchProceso = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchProceso")
Local $iCode = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Code")
Local $sMsg = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Msg")
$iPtoVta = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PtoVta")
Local $iCbteTipo = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteTipo")
$iCode = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Errors|*:Err|*:Code")
$sMsg = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Errors|*:Err|*:Msg")
$iCode = $oResponseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Events|*:Evt|*:Code")
$sMsg = $oResponseXml.GetChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Events|*:Evt|*:Msg")