ServiceSoap12 / FECompConsultar
ASP AutoIt C C (Unicode) C++ C++ (Unicode) C# DataFlex Delphi Foxpro Go Java Node.js Objective-C Perl PHP Extension PowerBuilder Powershell PureBasic Python CkPython Ruby SQL Server Swift TCL VB.NET VB6 VBScript Xojo
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkXml.pb"
Procedure ChilkatExample()
xml.i = CkXml::ckCreate()
If xml.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkXml::setCkTag(xml, "soap:Envelope")
CkXml::ckAddAttribute(xml,"xmlns:soap","http://www.w3.org/2003/05/soap-envelope")
CkXml::ckAddAttribute(xml,"xmlns:ar","http://ar.gov.afip.dif.FEV1/")
CkXml::ckUpdateChildContent(xml,"soap:Header","")
CkXml::ckUpdateChildContent(xml,"soap:Body|ar:FECompConsultar|ar:Auth|ar:Token","string")
CkXml::ckUpdateChildContent(xml,"soap:Body|ar:FECompConsultar|ar:Auth|ar:Sign","string")
CkXml::ckUpdateChildContentInt(xml,"soap:Body|ar:FECompConsultar|ar:Auth|ar:Cuit",123456)
CkXml::ckUpdateChildContentInt(xml,"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteTipo",1042)
CkXml::ckUpdateChildContentInt(xml,"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteNro",123456)
CkXml::ckUpdateChildContentInt(xml,"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.
CkXml::setCkEmitXmlDecl(xml, 0)
soapRequestBody.s = CkXml::ckGetXml(xml)
endpoint.s = "https://wswhomo.afip.gov.ar/wsfev1/service.asmx"
soapAction.s = "http://ar.gov.afip.dif.FEV1/FECompConsultar"
; For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
contentType.s = "text/xml"
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttp::ckClearHeaders(http)
CkHttp::ckSetRequestHeader(http,"Content-Type",contentType)
CkHttp::ckSetRequestHeader(http,"SOAPAction",soapAction)
resp.i = CkHttp::ckPostXml(http,endpoint,soapRequestBody,"utf-8")
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
Debug "Failed to send SOAP request."
CkXml::ckDispose(xml)
CkHttp::ckDispose(http)
ProcedureReturn
EndIf
; Get the XML response body.
responseXml.i = CkXml::ckCreate()
If responseXml.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkHttpResponse::ckGetBodyXml(resp,responseXml)
statusCode.i = CkHttpResponse::ckStatusCode(resp)
Debug "response status code: " + Str(statusCode)
CkHttpResponse::ckDispose(resp)
; If the status code does not indicate succcess, then show the response XML,
; which probably contains error information.
If statusCode <> 200
Debug CkXml::ckGetXml(responseXml)
CkXml::ckDispose(xml)
CkHttp::ckDispose(http)
CkXml::ckDispose(responseXml)
ProcedureReturn
EndIf
Debug CkXml::ckGetXml(responseXml)
; 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).
Concepto.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Concepto")
DocTipo.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocTipo")
DocNro.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocNro")
CbteDesde.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteDesde")
CbteHasta.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteHasta")
CbteFch.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteFch")
ImpTotal.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotal")
ImpTotConc.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotConc")
ImpNeto.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpNeto")
ImpOpEx.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpOpEx")
ImpTrib.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTrib")
ImpIVA.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpIVA")
FchServDesde.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServDesde")
FchServHasta.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServHasta")
FchVtoPago.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVtoPago")
MonId.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonId")
MonCotiz.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonCotiz")
Tipo.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Tipo")
PtoVta.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:PtoVta")
Nro.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Nro")
Cuit.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Cuit")
CbteFch = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:CbteFch")
Id.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Id")
Desc.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Desc")
BaseImp.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:BaseImp")
Alic.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Alic")
Importe.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Importe")
Id = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:Id")
BaseImp = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:BaseImp")
Importe = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:Importe")
strId.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Opcionales|*:Opcional|*:Id")
Valor.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Opcionales|*:Opcional|*:Valor")
DocTipo = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:DocTipo")
DocNro = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:DocNro")
Porcentaje.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:Porcentaje")
FchDesde.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchDesde")
FchHasta.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchHasta")
Id = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Actividades|*:Actividad|*:Id")
Resultado.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Resultado")
CodAutorizacion.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CodAutorizacion")
EmisionTipo.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:EmisionTipo")
FchVto.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVto")
FchProceso.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchProceso")
Code.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Code")
Msg.s = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Msg")
PtoVta = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PtoVta")
CbteTipo.i = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteTipo")
Code = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Errors|*:Err|*:Code")
Msg = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Errors|*:Err|*:Msg")
Code = CkXml::ckGetChildIntValue(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Events|*:Evt|*:Code")
Msg = CkXml::ckGetChildContent(responseXml,"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Events|*:Evt|*:Msg")
CkXml::ckDispose(xml)
CkHttp::ckDispose(http)
CkXml::ckDispose(responseXml)
ProcedureReturn
EndProcedure