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
#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",L"http://ws.pc.gif.com.br/");
    xml.AddAttribute(L"xmlns:nfs",L"http://nfse.abrasf.org.br");
    xml.AddAttribute(L"xmlns:ds",L"http://www.w3.org/2000/09/xmldsig#");
    xml.UpdateChildContent(L"soapenv:Header",L"");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote",true,L"versao",L"?");
    xml.UpdateChildContent(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|CNPJ",L"token string");
    xml.UpdateChildContent(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|cLote",L"string");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature",true,L"Id",L"?");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo",true,L"Id",L"?");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:CanonicalizationMethod",true,L"Algorithm",L"http://www.w3.org/TR/2001/REC-xml-c14n-20010315");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:SignatureMethod",true,L"Algorithm",L"http://www.w3.org/2000/09/xmldsig#rsa-sha1");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference",true,L"Id",L"?");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference",true,L"URI",L"?");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference",true,L"Type",L"?");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform",true,L"Algorithm",L"?");
    xml.UpdateChildContent(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform|ds:XPath",L"string");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestMethod",true,L"Algorithm",L"http://www.w3.org/2000/09/xmldsig#sha1");
    xml.UpdateChildContent(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestValue",L"BASE64_DATA");
    xml.UpdateChildContent(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignatureValue",L"...");
    xml.UpdateAttrAt(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo",true,L"Id",L"?");
    xml.UpdateChildContent(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509SubjectName",L"string");
    xml.UpdateChildContent(L"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509Certificate",L"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. 
    xml.put_EmitXmlDecl(false);
    const wchar_t *soapRequestBody = xml.getXml();

    const wchar_t *endpoint = L"https://canoas-homol.infisc.com.br/services/nfse/ws/Servicos";
    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 = http.PostXml(endpoint,soapRequestBody,L"utf-8");
    if (http.get_LastMethodSuccess() == 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);

    delete resp;

    // 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 *Envelope_xmlns = responseXml.getAttrValue(L"xmlns");
    const wchar_t *confirmaCancelamentoLote_versao = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|(versao)");
    const wchar_t *CNPJ = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|CNPJ");
    const wchar_t *cLote = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|cLote");
    const wchar_t *dhRecbto = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|dhRecbto");
    const wchar_t *sit = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|sit");
    const wchar_t *mot = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|mot");
    const wchar_t *Signature_Id = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|(Id)");
    const wchar_t *SignedInfo_Id = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|(Id)");
    const wchar_t *CanonicalizationMethod_Algorithm = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:CanonicalizationMethod|(Algorithm)");
    const wchar_t *SignatureMethod_Algorithm = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:SignatureMethod|(Algorithm)");
    const wchar_t *Reference_Id = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Id)");
    const wchar_t *Reference_URI = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(URI)");
    const wchar_t *Reference_Type = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Type)");
    const wchar_t *Transform_Algorithm = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|(Algorithm)");
    const wchar_t *XPath = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|*:XPath");
    const wchar_t *DigestMethod_Algorithm = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestMethod|(Algorithm)");
    const wchar_t *DigestValue = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestValue");
    const wchar_t *SignatureValue = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignatureValue");
    const wchar_t *KeyInfo_Id = responseXml.chilkatPath(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|(Id)");
    const wchar_t *X509SubjectName = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|*:X509Data|*:X509SubjectName");
    const wchar_t *X509Certificate = responseXml.getChildContent(L"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|*:X509Data|*:X509Certificate");
    }
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>