SOAP WSDL Generate Code

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
#include <C_CkXmlW.h>
#include <C_CkHttpW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkXmlW xml;
    const wchar_t *soapRequestBody;
    const wchar_t *endpoint;
    const wchar_t *soapAction;
    const wchar_t *contentType;
    HCkHttpW http;
    HCkHttpResponseW resp;
    HCkXmlW responseXml;
    int statusCode;
    int Concepto;
    int DocTipo;
    int DocNro;
    int CbteDesde;
    int CbteHasta;
    const wchar_t *CbteFch;
    const wchar_t *ImpTotal;
    const wchar_t *ImpTotConc;
    const wchar_t *ImpNeto;
    const wchar_t *ImpOpEx;
    const wchar_t *ImpTrib;
    const wchar_t *ImpIVA;
    const wchar_t *FchServDesde;
    const wchar_t *FchServHasta;
    const wchar_t *FchVtoPago;
    const wchar_t *MonId;
    const wchar_t *MonCotiz;
    int Tipo;
    int PtoVta;
    int Nro;
    const wchar_t *Cuit;
    int Id;
    const wchar_t *Desc;
    const wchar_t *BaseImp;
    const wchar_t *Alic;
    const wchar_t *Importe;
    const wchar_t *strId;
    const wchar_t *Valor;
    const wchar_t *Porcentaje;
    const wchar_t *FchDesde;
    const wchar_t *FchHasta;
    const wchar_t *Resultado;
    const wchar_t *CodAutorizacion;
    const wchar_t *EmisionTipo;
    const wchar_t *FchVto;
    const wchar_t *FchProceso;
    int Code;
    const wchar_t *Msg;
    int CbteTipo;

    xml = CkXmlW_Create();
    CkXmlW_putTag(xml,L"soap:Envelope");
    CkXmlW_AddAttribute(xml,L"xmlns:soap",L"http://www.w3.org/2003/05/soap-envelope");
    CkXmlW_AddAttribute(xml,L"xmlns:ar",L"http://ar.gov.afip.dif.FEV1/");
    CkXmlW_UpdateChildContent(xml,L"soap:Header",L"");
    CkXmlW_UpdateChildContent(xml,L"soap:Body|ar:FECompConsultar|ar:Auth|ar:Token",L"string");
    CkXmlW_UpdateChildContent(xml,L"soap:Body|ar:FECompConsultar|ar:Auth|ar:Sign",L"string");
    CkXmlW_UpdateChildContentInt(xml,L"soap:Body|ar:FECompConsultar|ar:Auth|ar:Cuit",123456);
    CkXmlW_UpdateChildContentInt(xml,L"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteTipo",1042);
    CkXmlW_UpdateChildContentInt(xml,L"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteNro",123456);
    CkXmlW_UpdateChildContentInt(xml,L"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. 
    CkXmlW_putEmitXmlDecl(xml,FALSE);
    soapRequestBody = CkXmlW_getXml(xml);

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

    http = CkHttpW_Create();

    CkHttpW_ClearHeaders(http);
    CkHttpW_SetRequestHeader(http,L"Content-Type",contentType);
    CkHttpW_SetRequestHeader(http,L"SOAPAction",soapAction);

    resp = CkHttpW_PostXml(http,endpoint,soapRequestBody,L"utf-8");
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        wprintf(L"Failed to send SOAP request.\n");
        CkXmlW_Dispose(xml);
        CkHttpW_Dispose(http);
        return;
    }

    // Get the XML response body.
    responseXml = CkXmlW_Create();
    CkHttpResponseW_GetBodyXml(resp,responseXml);

    statusCode = CkHttpResponseW_getStatusCode(resp);
    wprintf(L"response status code: %d\n",statusCode);

    CkHttpResponseW_Dispose(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",CkXmlW_getXml(responseXml));
        CkXmlW_Dispose(xml);
        CkHttpW_Dispose(http);
        CkXmlW_Dispose(responseXml);
        return;
    }

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


    CkXmlW_Dispose(xml);
    CkHttpW_Dispose(http);
    CkXmlW_Dispose(responseXml);

    }
Request XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ar="http://ar.gov.afip.dif.FEV1/">
    <soap:Header/>
    <soap: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>
    </soap:Body>
</soap:Envelope>
Response XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ar="http://ar.gov.afip.dif.FEV1/">
    <soap:Header/>
    <soap: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>
    </soap:Body>
</soap:Envelope>