SOAP WSDL Generate Code

ServicosPortSoap11 / cancelarLote

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
var
xml: HCkXml;
soapRequestBody: PWideChar;
endpoint: PWideChar;
soapAction: PWideChar;
contentType: PWideChar;
http: HCkHttp;
resp: HCkHttpResponse;
responseXml: HCkXml;
statusCode: Integer;
Envelope_xmlns: PWideChar;
confirmaCancelamentoLote_versao: PWideChar;
CNPJ: PWideChar;
cLote: PWideChar;
dhRecbto: PWideChar;
sit: PWideChar;
mot: PWideChar;
Signature_Id: PWideChar;
SignedInfo_Id: PWideChar;
CanonicalizationMethod_Algorithm: PWideChar;
SignatureMethod_Algorithm: PWideChar;
Reference_Id: PWideChar;
Reference_URI: PWideChar;
Reference_Type: PWideChar;
Transform_Algorithm: PWideChar;
XPath: PWideChar;
DigestMethod_Algorithm: PWideChar;
DigestValue: PWideChar;
SignatureValue: PWideChar;
KeyInfo_Id: PWideChar;
X509SubjectName: PWideChar;
X509Certificate: PWideChar;

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_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote',True,'versao','?');
CkXml_UpdateChildContent(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|CNPJ','token string');
CkXml_UpdateChildContent(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|cLote','string');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature',True,'Id','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo',True,'Id','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:CanonicalizationMethod',True,'Algorithm','http://www.w3.org/TR/2001/REC-xml-c14n-20010315');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:SignatureMethod',True,'Algorithm','http://www.w3.org/2000/09/xmldsig#rsa-sha1');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference',True,'Id','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference',True,'URI','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference',True,'Type','?');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform',True,'Algorithm','?');
CkXml_UpdateChildContent(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform|ds:XPath','string');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestMethod',True,'Algorithm','http://www.w3.org/2000/09/xmldsig#sha1');
CkXml_UpdateChildContent(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestValue','BASE64_DATA');
CkXml_UpdateChildContent(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignatureValue','...');
CkXml_UpdateAttrAt(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo',True,'Id','?');
CkXml_UpdateChildContent(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509SubjectName','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|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) then
  begin
    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) then
  begin
    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).

Envelope_xmlns := CkXml__getAttrValue(responseXml,'xmlns');
confirmaCancelamentoLote_versao := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|(versao)');
CNPJ := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|CNPJ');
cLote := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|cLote');
dhRecbto := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|dhRecbto');
sit := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|sit');
mot := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|mot');
Signature_Id := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|(Id)');
SignedInfo_Id := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|(Id)');
CanonicalizationMethod_Algorithm := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:CanonicalizationMethod|(Algorithm)');
SignatureMethod_Algorithm := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:SignatureMethod|(Algorithm)');
Reference_Id := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Id)');
Reference_URI := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(URI)');
Reference_Type := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Type)');
Transform_Algorithm := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|(Algorithm)');
XPath := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|*:XPath');
DigestMethod_Algorithm := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestMethod|(Algorithm)');
DigestValue := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestValue');
SignatureValue := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignatureValue');
KeyInfo_Id := CkXml__chilkatPath(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|(Id)');
X509SubjectName := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|*:X509Data|*:X509SubjectName');
X509Certificate := CkXml__getChildContent(responseXml,'*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|*:X509Data|*:X509Certificate');

CkXml_Dispose(xml);
CkHttp_Dispose(http);
CkXml_Dispose(responseXml);

Request XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://ws.pc.gif.com.br/" xmlns:nfs="http://nfse.abrasf.org.br" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <soapenv:Header/>
    <soapenv:Body>
        <cancelarLoteRequest>
            <pedidoCancelamentoLote versao="?">
                <CNPJ>token string</CNPJ>
                <cLote>string</cLote>
                <ds:Signature Id="?">
                    <ds:SignedInfo Id="?">
                        <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
                        <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
                        <ds:Reference Id="?" URI="?" Type="?">
                            <ds:Transforms>
                                <ds:Transform Algorithm="?">
                                    <ds:XPath>string</ds:XPath>
                                </ds:Transform>
                            </ds:Transforms>
                            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                            <ds:DigestValue>BASE64_DATA</ds:DigestValue>
                        </ds:Reference>
                    </ds:SignedInfo>
                    <ds:SignatureValue>...</ds:SignatureValue>
                    <ds:KeyInfo Id="?">
                        <ds:X509Data>
                            <ds:X509SubjectName>string</ds:X509SubjectName>
                            <ds:X509Certificate>BqozVXeZZg==</ds:X509Certificate>
                        </ds:X509Data>
                    </ds:KeyInfo>
                </ds:Signature>
            </pedidoCancelamentoLote>
        </cancelarLoteRequest>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://ws.pc.gif.com.br/" xmlns:nfs="http://nfse.abrasf.org.br" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <soapenv:Header/>
    <soapenv:Body>
        <cancelarLoteResponse>
            <confirmaCancelamentoLote versao="?">
                <CNPJ>token string</CNPJ>
                <cLote>string</cLote>
                <dhRecbto>string</dhRecbto>
                <sit>positiveInteger</sit>
                <mot>string</mot>
                <ds:Signature Id="?">
                    <ds:SignedInfo Id="?">
                        <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
                        <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
                        <ds:Reference Id="?" URI="?" Type="?">
                            <ds:Transforms>
                                <ds:Transform Algorithm="?">
                                    <ds:XPath>string</ds:XPath>
                                </ds:Transform>
                            </ds:Transforms>
                            <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                            <ds:DigestValue>BASE64_DATA</ds:DigestValue>
                        </ds:Reference>
                    </ds:SignedInfo>
                    <ds:SignatureValue>...</ds:SignatureValue>
                    <ds:KeyInfo Id="?">
                        <ds:X509Data>
                            <ds:X509SubjectName>string</ds:X509SubjectName>
                            <ds:X509Certificate>BqozVXeZZg==</ds:X509Certificate>
                        </ds:X509Data>
                    </ds:KeyInfo>
                </ds:Signature>
            </confirmaCancelamentoLote>
        </cancelarLoteResponse>
    </soapenv:Body>
</soapenv:Envelope>