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 <CkXml.h>
#include <CkHttp.h>
#include <CkHttpResponse.h>

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

    const char *endpoint = "https://wswhomo.afip.gov.ar/wsfev1/service.asmx";
    const char *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"
    const char *contentType = "text/xml";

    CkHttp http;

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

    CkHttpResponse *resp = http.PostXml(endpoint,soapRequestBody,"utf-8");
    if (http.get_LastMethodSuccess() == false) {
        std::cout << http.lastErrorText() << "\r\n";
        std::cout << "Failed to send SOAP request." << "\r\n";
        return;
    }

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

    int statusCode = resp->get_StatusCode();
    std::cout << "response status code: " << statusCode << "\r\n";

    delete resp;

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

    std::cout << responseXml.getXml() << "\r\n";

    // 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("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Concepto");
    int DocTipo = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocTipo");
    int DocNro = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocNro");
    int CbteDesde = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteDesde");
    int CbteHasta = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteHasta");
    const char *CbteFch = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteFch");
    const char *ImpTotal = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotal");
    const char *ImpTotConc = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotConc");
    const char *ImpNeto = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpNeto");
    const char *ImpOpEx = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpOpEx");
    const char *ImpTrib = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTrib");
    const char *ImpIVA = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpIVA");
    const char *FchServDesde = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServDesde");
    const char *FchServHasta = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServHasta");
    const char *FchVtoPago = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVtoPago");
    const char *MonId = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonId");
    const char *MonCotiz = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonCotiz");
    int Tipo = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Tipo");
    int PtoVta = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:PtoVta");
    int Nro = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Nro");
    const char *Cuit = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Cuit");
    CbteFch = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:CbteFch");
    int Id = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Id");
    const char *Desc = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Desc");
    const char *BaseImp = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:BaseImp");
    const char *Alic = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Alic");
    const char *Importe = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Importe");
    Id = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:Id");
    BaseImp = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:BaseImp");
    Importe = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Iva|*:AlicIva|*:Importe");
    const char *strId = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Opcionales|*:Opcional|*:Id");
    const char *Valor = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Opcionales|*:Opcional|*:Valor");
    DocTipo = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:DocTipo");
    DocNro = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:DocNro");
    const char *Porcentaje = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:Porcentaje");
    const char *FchDesde = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchDesde");
    const char *FchHasta = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchHasta");
    Id = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Actividades|*:Actividad|*:Id");
    const char *Resultado = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Resultado");
    const char *CodAutorizacion = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CodAutorizacion");
    const char *EmisionTipo = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:EmisionTipo");
    const char *FchVto = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVto");
    const char *FchProceso = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchProceso");
    int Code = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Code");
    const char *Msg = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Msg");
    PtoVta = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PtoVta");
    int CbteTipo = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteTipo");
    Code = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Errors|*:Err|*:Code");
    Msg = responseXml.getChildContent("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Errors|*:Err|*:Msg");
    Code = responseXml.GetChildIntValue("*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:Events|*:Evt|*:Code");
    Msg = responseXml.getChildContent("*: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>