var
xml: HCkXml;
soapRequestBody: PWideChar;
endpoint: PWideChar;
soapAction: PWideChar;
contentType: PWideChar;
http: HCkHttp;
resp: HCkHttpResponse;
responseXml: HCkXml;
statusCode: Integer;
begin
xml := CkXml_Create();
CkXml_putTag(xml,'soapenv:Envelope');
CkXml_AddAttribute(xml,'xmlns:soapenv','http://schemas.xmlsoap.org/soap/envelope/');
CkXml_AddAttribute(xml,'xmlns','http://ws.pc.gif.com.br/');
CkXml_AddAttribute(xml,'xmlns:nfs','http://nfse.abrasf.org.br');
CkXml_AddAttribute(xml,'xmlns:ds','http://www.w3.org/2000/09/xmldsig#');
CkXml_UpdateChildContent(xml,'soapenv:Header','');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|idCC|chaveAcesso','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|idCC|cnpjCpf','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|tomadorCC|email','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|tomadorCC|telefone','token string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|tomadorCC|inscricaoMunicipal','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|tomadorCC|inscricaoEstadual','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|tomadorCC|cep','token string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|tomadorCC|logradouro','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|tomadorCC|numeroLogradouro','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|tomadorCC|bairro','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|construcaoCC|numeroART','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|construcaoCC|numeroCEI','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|construcaoCC|numeroMatricula','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|construcaoCC|numeroProjeto','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|cnpjCpf','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|nome','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|inscricaoEstadual','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|placaVeiculo','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|endereco','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|nomeCidade','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|codigoCidade','token string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|uf','EX');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|nomePais','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|codigoPais','token string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|transportadoraCC|tipoFrete','token string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|servicosCC|servicoCC|ordem','positiveInteger');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|servicosCC|servicoCC|descricao','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|faturasCC|faturaCC|ordem','positiveInteger');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|faturasCC|faturaCC|numero','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|faturasCC|faturaCC|dataVencimento','date');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|observacoesCC|observacaoCC|ordem','positiveInteger');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|observacoesCC|observacaoCC|descricao','string');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature',True,'Id','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo',True,'Id','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo|ds:CanonicalizationMethod',True,'Algorithm','http://www.w3.org/TR/2001/REC-xml-c14n-20010315');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo|ds:SignatureMethod',True,'Algorithm','http://www.w3.org/2000/09/xmldsig#rsa-sha1');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo|ds:Reference',True,'Id','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo|ds:Reference',True,'URI','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo|ds:Reference',True,'Type','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform',True,'Algorithm','?');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform|ds:XPath','string');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestMethod',True,'Algorithm','http://www.w3.org/2000/09/xmldsig#sha1');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestValue','BASE64_DATA');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:SignatureValue','...');
CkXml_UpdateAttrAt(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:KeyInfo',True,'Id','?');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509SubjectName','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|corrigirNFSeRequest|cartaCorrecao|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509Certificate','BqozVXeZZg==');
// In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required. CkXml_putEmitXmlDecl(xml,False);
soapRequestBody := CkXml__getXml(xml);
endpoint := 'https://canoas-homol.infisc.com.br/services/nfse/ws/Servicos';
soapAction := '';
// For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
contentType := 'text/xml';
http := CkHttp_Create();
CkHttp_ClearHeaders(http);
CkHttp_SetRequestHeader(http,'Content-Type',contentType);
CkHttp_SetRequestHeader(http,'SOAPAction',soapAction);
resp := CkHttp_PostXml(http,endpoint,soapRequestBody,'utf-8');
if (CkHttp_getLastMethodSuccess(http) = False) thenbegin
Memo1.Lines.Add(CkHttp__lastErrorText(http));
Memo1.Lines.Add('Failed to send SOAP request.');
Exit;
end;
// Get the XML response body.
responseXml := CkXml_Create();
CkHttpResponse_GetBodyXml(resp,responseXml);
statusCode := CkHttpResponse_getStatusCode(resp);
Memo1.Lines.Add('response status code: ' + IntToStr(statusCode));
CkHttpResponse_Dispose(resp);
// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.if (statusCode <> 200) thenbegin
Memo1.Lines.Add(CkXml__getXml(responseXml));
Exit;
end;
Memo1.Lines.Add(CkXml__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).
CkXml_Dispose(xml);
CkHttp_Dispose(http);
CkXml_Dispose(responseXml);