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
#import <CkoXml.h>
#import <NSString.h>
#import <CkoHttp.h>
#import <CkoHttpResponse.h>
CkoXml *xml = [[CkoXml alloc] init];
xml.Tag = @"soap:Envelope";
[xml AddAttribute: @"xmlns:soap" value: @"http://www.w3.org/2003/05/soap-envelope"];
[xml AddAttribute: @"xmlns:ar" value: @"http://ar.gov.afip.dif.FEV1/"];
[xml UpdateChildContent: @"soap:Header" value: @""];
[xml UpdateChildContent: @"soap:Body|ar:FECompConsultar|ar:Auth|ar:Token" value: @"string"];
[xml UpdateChildContent: @"soap:Body|ar:FECompConsultar|ar:Auth|ar:Sign" value: @"string"];
[xml UpdateChildContentInt: @"soap:Body|ar:FECompConsultar|ar:Auth|ar:Cuit" value: [NSNumber numberWithInt: 123456]];
[xml UpdateChildContentInt: @"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteTipo" value: [NSNumber numberWithInt: 1042]];
[xml UpdateChildContentInt: @"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:CbteNro" value: [NSNumber numberWithInt: 123456]];
[xml UpdateChildContentInt: @"soap:Body|ar:FECompConsultar|ar:FeCompConsReq|ar:PtoVta" value: [NSNumber numberWithInt: 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 = NO;
NSString *soapRequestBody = [xml GetXml];
NSString *endpoint = @"https://wswhomo.afip.gov.ar/wsfev1/service.asmx";
NSString *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"
NSString *contentType = @"text/xml";
CkoHttp *http = [[CkoHttp alloc] init];
[http ClearHeaders];
[http SetRequestHeader: @"Content-Type" value: contentType];
[http SetRequestHeader: @"SOAPAction" value: soapAction];
CkoHttpResponse *resp = [http PostXml: endpoint xmlDoc: soapRequestBody charset: @"utf-8"];
if (http.LastMethodSuccess == NO) {
NSLog(@"%@",http.LastErrorText);
NSLog(@"%@",@"Failed to send SOAP request.");
return;
}
// Get the XML response body.
CkoXml *responseXml = [[CkoXml alloc] init];
[resp GetBodyXml: responseXml];
int statusCode = [resp.StatusCode intValue];
NSLog(@"%@%d",@"response status code: ",statusCode);
// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.
if (statusCode != 200) {
NSLog(@"%@",[responseXml GetXml]);
return;
}
NSLog(@"%@",[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: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Concepto"] intValue];
int DocTipo = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocTipo"] intValue];
int DocNro = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:DocNro"] intValue];
int CbteDesde = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteDesde"] intValue];
int CbteHasta = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteHasta"] intValue];
NSString *CbteFch = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbteFch"];
NSString *ImpTotal = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotal"];
NSString *ImpTotConc = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTotConc"];
NSString *ImpNeto = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpNeto"];
NSString *ImpOpEx = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpOpEx"];
NSString *ImpTrib = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpTrib"];
NSString *ImpIVA = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:ImpIVA"];
NSString *FchServDesde = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServDesde"];
NSString *FchServHasta = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchServHasta"];
NSString *FchVtoPago = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVtoPago"];
NSString *MonId = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonId"];
NSString *MonCotiz = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:MonCotiz"];
int Tipo = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Tipo"] intValue];
int PtoVta = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:PtoVta"] intValue];
int Nro = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CbtesAsoc|*:CbteAsoc|*:Nro"] intValue];
NSString *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"] intValue];
NSString *Desc = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Desc"];
NSString *BaseImp = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:BaseImp"];
NSString *Alic = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Tributos|*:Tributo|*:Alic"];
NSString *Importe = [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"];
NSString *strId = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Opcionales|*:Opcional|*:Id"];
NSString *Valor = [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];
NSString *Porcentaje = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Compradores|*:Comprador|*:Porcentaje"];
NSString *FchDesde = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchDesde"];
NSString *FchHasta = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PeriodoAsoc|*:FchHasta"];
Id = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Actividades|*:Actividad|*:Id"] intValue];
NSString *Resultado = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Resultado"];
NSString *CodAutorizacion = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:CodAutorizacion"];
NSString *EmisionTipo = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:EmisionTipo"];
NSString *FchVto = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchVto"];
NSString *FchProceso = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:FchProceso"];
int Code = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Code"] intValue];
NSString *Msg = [responseXml GetChildContent: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:Observaciones|*:Obs|*:Msg"];
PtoVta = [[responseXml GetChildIntValue: @"*:Body|*:FECompConsultarResponse|*:FECompConsultarResult|*:ResultGet|*:PtoVta"] intValue];
int CbteTipo = [[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
<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>