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
func chilkatTest() {
    let xml = CkoXml()
    xml.Tag = "soapenv:Envelope"
    xml.AddAttribute("xmlns:soapenv", value: "http://schemas.xmlsoap.org/soap/envelope/")
    xml.AddAttribute("xmlns:ar", value: "http://ar.gov.afip.dif.FEV1/")
    xml.UpdateChildContent("soapenv:Header", value: "")
    xml.UpdateChildContent("soapenv:Body|ar:FECompConsultar|ar:Auth|ar:Token", value: "string")
    xml.UpdateChildContent("soapenv:Body|ar:FECompConsultar|ar:Auth|ar:Sign", value: "string")
    xml.UpdateChildContentInt("soapenv:Body|ar:FECompConsultar|ar:Auth|ar:Cuit", value: 123456)
    xml.UpdateChildContentInt("soapenv:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteTipo", value: 1042)
    xml.UpdateChildContentInt("soapenv:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteNro", value: 123456)
    xml.UpdateChildContentInt("soapenv:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:PtoVta", value: 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.EmitXmlDecl = false
    var soapRequestBody: String? = xml.GetXml()

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

    let http = CkoHttp()

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

    var resp: CkoHttpResponse? = http.PostXml(endpoint, xmlDoc: soapRequestBody, charset: "utf-8")
    if http.LastMethodSuccess == false {
        print("\(http.LastErrorText)")
        print("Failed to send SOAP request.")
        return
    }

    // Get the XML response body.
    let responseXml = CkoXml()
    resp!.GetBodyXml(responseXml)

    var statusCode: Int = resp!.StatusCode.intValue
    print("response status code: \(statusCode)")

    resp = nil

    // If the status code does not indicate succcess, then show the response XML,
    // which probably contains error information.
    if statusCode != 200 {
        print("\(responseXml.GetXml())")
        return
    }

    print("\(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).

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