SOAP WSDL Generate Code

ServiceSoap / 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
#include <CkXmlW.h>
#include <CkHttpW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    CkXmlW xml;
    xml.put_Tag(L"soapenv:Envelope");
    xml.AddAttribute(L"xmlns:soapenv",L"http://schemas.xmlsoap.org/soap/envelope/");
    xml.AddAttribute(L"xmlns:ar",L"http://ar.gov.afip.dif.FEV1/");
    xml.UpdateChildContent(L"soapenv:Header",L"");
    xml.UpdateChildContent(L"soapenv:Body|ar:FECompConsultar|ar:Auth|ar:Token",L"string");
    xml.UpdateChildContent(L"soapenv:Body|ar:FECompConsultar|ar:Auth|ar:Sign",L"string");
    xml.UpdateChildContentInt(L"soapenv:Body|ar:FECompConsultar|ar:Auth|ar:Cuit",123456);
    xml.UpdateChildContentInt(L"soapenv:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteTipo",1042);
    xml.UpdateChildContentInt(L"soapenv:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteNro",123456);
    xml.UpdateChildContentInt(L"soapenv: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. 
    xml.put_EmitXmlDecl(false);
    const wchar_t *soapRequestBody = xml.getXml();

    const wchar_t *endpoint = L"https://wswhomo.afip.gov.ar/wsfev1/service.asmx";
    const wchar_t *soapAction = L"http://ar.gov.afip.dif.FEV1/FECompConsultar";
    //  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
    const wchar_t *contentType = L"text/xml";

    CkHttpW http;

    http.ClearHeaders();
    http.SetRequestHeader(L"Content-Type",contentType);
    http.SetRequestHeader(L"SOAPAction",soapAction);

    CkHttpResponseW *resp = http.PostXml(endpoint,soapRequestBody,L"utf-8");
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        wprintf(L"Failed to send SOAP request.\n");
        return;
    }

    // Get the XML response body.
    CkXmlW responseXml;
    resp->GetBodyXml(responseXml);

    int statusCode = resp->get_StatusCode();
    wprintf(L"response status code: %d\n",statusCode);

    delete resp;

    // If the status code does not indicate succcess, then show the response XML,
    // which probably contains error information.
    if (statusCode != 200) {
        wprintf(L"%s\n",responseXml.getXml());
        return;
    }

    wprintf(L"%s\n",responseXml.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).

    int Concepto = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Concepto");
    int DocTipo = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocTipo");
    int DocNro = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocNro");
    int CbteDesde = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteDesde");
    int CbteHasta = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteHasta");
    const wchar_t *CbteFch = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteFch");
    const wchar_t *ImpTotal = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotal");
    const wchar_t *ImpTotConc = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotConc");
    const wchar_t *ImpNeto = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpNeto");
    const wchar_t *ImpOpEx = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpOpEx");
    const wchar_t *ImpTrib = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTrib");
    const wchar_t *ImpIVA = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpIVA");
    const wchar_t *FchServDesde = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServDesde");
    const wchar_t *FchServHasta = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServHasta");
    const wchar_t *FchVtoPago = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVtoPago");
    const wchar_t *MonId = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonId");
    const wchar_t *MonCotiz = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonCotiz");
    int Tipo = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Tipo");
    int PtoVta = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:PtoVta");
    int Nro = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Nro");
    const wchar_t *Cuit = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Cuit");
    CbteFch = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:CbteFch");
    int Id = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Id");
    const wchar_t *Desc = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Desc");
    const wchar_t *BaseImp = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:BaseImp");
    const wchar_t *Alic = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Alic");
    const wchar_t *Importe = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Importe");
    Id = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:Id");
    BaseImp = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:BaseImp");
    Importe = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:Importe");
    const wchar_t *strId = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Opcionales|*:Opcional|*:Id");
    const wchar_t *Valor = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Opcionales|*:Opcional|*:Valor");
    DocTipo = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:DocTipo");
    DocNro = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:DocNro");
    const wchar_t *Porcentaje = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:Porcentaje");
    const wchar_t *FchDesde = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchDesde");
    const wchar_t *FchHasta = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchHasta");
    Id = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Actividades|*:Actividad|*:Id");
    const wchar_t *Resultado = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Resultado");
    const wchar_t *CodAutorizacion = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CodAutorizacion");
    const wchar_t *EmisionTipo = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:EmisionTipo");
    const wchar_t *FchVto = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVto");
    const wchar_t *FchProceso = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchProceso");
    int Code = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Code");
    const wchar_t *Msg = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Msg");
    PtoVta = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PtoVta");
    int CbteTipo = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteTipo");
    Code = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Errors|*:Err|*:Code");
    Msg = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Errors|*:Err|*:Msg");
    Code = responseXml.GetChildIntValue(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Events|*:Evt|*:Code");
    Msg = responseXml.getChildContent(L"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Events|*:Evt|*:Msg");
    }
Request XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ar="http://ar.gov.afip.dif.FEV1/">
    <soapenv:Header/>
    <soapenv:Body>
        <ar:FECompConsultar>
            <ar:Auth>
                <ar:Token>string</ar:Token>
                <ar:Sign>string</ar:Sign>
                <ar:Cuit>123456</ar:Cuit>
            </ar:Auth>
            <ar:FeCompConsReq>
                <ar:CbteTipo>1042</ar:CbteTipo>
                <ar:CbteNro>123456</ar:CbteNro>
                <ar:PtoVta>1042</ar:PtoVta>
            </ar:FeCompConsReq>
        </ar:FECompConsultar>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ar="http://ar.gov.afip.dif.FEV1/">
    <soapenv:Header/>
    <soapenv:Body>
        <ar:FECompConsultarResponse>
            <ar:FECompConsultarResult>
                <ar:ResultGet>
                    <ar:Concepto>1042</ar:Concepto>
                    <ar:DocTipo>1042</ar:DocTipo>
                    <ar:DocNro>123456</ar:DocNro>
                    <ar:CbteDesde>123456</ar:CbteDesde>
                    <ar:CbteHasta>123456</ar:CbteHasta>
                    <ar:CbteFch>string</ar:CbteFch>
                    <ar:ImpTotal>456.00</ar:ImpTotal>
                    <ar:ImpTotConc>456.00</ar:ImpTotConc>
                    <ar:ImpNeto>456.00</ar:ImpNeto>
                    <ar:ImpOpEx>456.00</ar:ImpOpEx>
                    <ar:ImpTrib>456.00</ar:ImpTrib>
                    <ar:ImpIVA>456.00</ar:ImpIVA>
                    <ar:FchServDesde>string</ar:FchServDesde>
                    <ar:FchServHasta>string</ar:FchServHasta>
                    <ar:FchVtoPago>string</ar:FchVtoPago>
                    <ar:MonId>string</ar:MonId>
                    <ar:MonCotiz>456.00</ar:MonCotiz>
                    <ar:CbtesAsoc>
                        <ar:CbteAsoc>
                            <ar:Tipo>1042</ar:Tipo>
                            <ar:PtoVta>1042</ar:PtoVta>
                            <ar:Nro>123456</ar:Nro>
                            <ar:Cuit>string</ar:Cuit>
                            <ar:CbteFch>string</ar:CbteFch>
                        </ar:CbteAsoc>
                    </ar:CbtesAsoc>
                    <ar:Tributos>
                        <ar:Tributo>
                            <ar:Id>442</ar:Id>
                            <ar:Desc>string</ar:Desc>
                            <ar:BaseImp>456.00</ar:BaseImp>
                            <ar:Alic>456.00</ar:Alic>
                            <ar:Importe>456.00</ar:Importe>
                        </ar:Tributo>
                    </ar:Tributos>
                    <ar:Iva>
                        <ar:AlicIva>
                            <ar:Id>1042</ar:Id>
                            <ar:BaseImp>456.00</ar:BaseImp>
                            <ar:Importe>456.00</ar:Importe>
                        </ar:AlicIva>
                    </ar:Iva>
                    <ar:Opcionales>
                        <ar:Opcional>
                            <ar:Id>string</ar:Id>
                            <ar:Valor>string</ar:Valor>
                        </ar:Opcional>
                    </ar:Opcionales>
                    <ar:Compradores>
                        <ar:Comprador>
                            <ar:DocTipo>1042</ar:DocTipo>
                            <ar:DocNro>123456</ar:DocNro>
                            <ar:Porcentaje>456.00</ar:Porcentaje>
                        </ar:Comprador>
                    </ar:Compradores>
                    <ar:PeriodoAsoc>
                        <ar:FchDesde>string</ar:FchDesde>
                        <ar:FchHasta>string</ar:FchHasta>
                    </ar:PeriodoAsoc>
                    <ar:Actividades>
                        <ar:Actividad>
                            <ar:Id>123456</ar:Id>
                        </ar:Actividad>
                    </ar:Actividades>
                    <ar:Resultado>string</ar:Resultado>
                    <ar:CodAutorizacion>string</ar:CodAutorizacion>
                    <ar:EmisionTipo>string</ar:EmisionTipo>
                    <ar:FchVto>string</ar:FchVto>
                    <ar:FchProceso>string</ar:FchProceso>
                    <ar:Observaciones>
                        <ar:Obs>
                            <ar:Code>1042</ar:Code>
                            <ar:Msg>string</ar:Msg>
                        </ar:Obs>
                    </ar:Observaciones>
                    <ar:PtoVta>1042</ar:PtoVta>
                    <ar:CbteTipo>1042</ar:CbteTipo>
                </ar:ResultGet>
                <ar:Errors>
                    <ar:Err>
                        <ar:Code>1042</ar:Code>
                        <ar:Msg>string</ar:Msg>
                    </ar:Err>
                </ar:Errors>
                <ar:Events>
                    <ar:Evt>
                        <ar:Code>1042</ar:Code>
                        <ar:Msg>string</ar:Msg>
                    </ar:Evt>
                </ar:Events>
            </ar:FECompConsultarResult>
        </ar:FECompConsultarResponse>
    </soapenv:Body>
</soapenv:Envelope>