#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:sfLRC",L"https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/ConsultaLR.xsd");
xml.AddAttribute(L"xmlns:sf",L"https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd");
xml.UpdateChildContent(L"soapenv:Header",L"");
xml.UpdateChildContent(L"soapenv:Body|sfLRC:ConsultaFactuSistemaFacturacion|sfLRC:Cabecera|sf:IDVersion",L"1.0");
xml.UpdateChildContent(L"soapenv:Body|sfLRC:ConsultaFactuSistemaFacturacion|sfLRC:FiltroConsulta|sfLRC:PeriodoImputacion|sf:Ejercicio",L"string");
xml.UpdateChildContentInt(L"soapenv:Body|sfLRC:ConsultaFactuSistemaFacturacion|sfLRC:FiltroConsulta|sfLRC:PeriodoImputacion|sf:Periodo",01);
// 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://www1.agenciatributaria.gob.es/wlpl/TIKE-CONT/ws/SistemaFacturacion/VerifactuSOAP";
const wchar_t *soapAction = L"";
// 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;
ERROR: Undefined variable(success)
ERROR: Undefined variable(success)
if (success == 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);
// 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).const wchar_t *IDVersion = responseXml.getChildContent(L"*:Body|*:RespuestaConsultaFactuSistemaFacturacion|*:Cabecera|*:IDVersion");
const wchar_t *Ejercicio = responseXml.getChildContent(L"*:Body|*:RespuestaConsultaFactuSistemaFacturacion|*:PeriodoImputacion|*:Ejercicio");
int Periodo = responseXml.GetChildIntValue(L"*:Body|*:RespuestaConsultaFactuSistemaFacturacion|*:PeriodoImputacion|*:Periodo");
const wchar_t *IndicadorPaginacion = responseXml.getChildContent(L"*:Body|*:RespuestaConsultaFactuSistemaFacturacion|*:IndicadorPaginacion");
const wchar_t *ResultadoConsulta = responseXml.getChildContent(L"*:Body|*:RespuestaConsultaFactuSistemaFacturacion|*:ResultadoConsulta");
}