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
Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoXml
    Boolean iSuccess
    String sSoapRequestBody
    String sEndpoint
    String sSoapAction
    String sContentType
    Handle hoHttp
    Variant vResp
    Handle hoResp
    Variant vResponseXml
    Handle hoResponseXml
    Integer iStatusCode
    String sEnvelope_xmlns
    String sConfirmaCancelamentoLote_versao
    String sCNPJ
    String sCLote
    String sDhRecbto
    String sSit
    String sMot
    String sSignature_Id
    String sSignedInfo_Id
    String sCanonicalizationMethod_Algorithm
    String sSignatureMethod_Algorithm
    String sReference_Id
    String sReference_URI
    String sReference_Type
    String sTransform_Algorithm
    String sXPath
    String sDigestMethod_Algorithm
    String sDigestValue
    String sSignatureValue
    String sKeyInfo_Id
    String sX509SubjectName
    String sX509Certificate
    String sTemp1
    Boolean bTemp1

    Get Create (RefClass(cComChilkatXml)) To hoXml
    If (Not(IsComObjectCreated(hoXml))) Begin
        Send CreateComObject of hoXml
    End
    Set ComTag Of hoXml To "soapenv:Envelope"
    Get ComAddAttribute Of hoXml "xmlns:soapenv" "http://schemas.xmlsoap.org/soap/envelope/" To iSuccess
    Get ComAddAttribute Of hoXml "xmlns" "http://ws.pc.gif.com.br/" To iSuccess
    Get ComAddAttribute Of hoXml "xmlns:nfs" "http://nfse.abrasf.org.br" To iSuccess
    Get ComAddAttribute Of hoXml "xmlns:ds" "http://www.w3.org/2000/09/xmldsig#" To iSuccess
    Send ComUpdateChildContent To hoXml "soapenv:Header" ""
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote" True "versao" "?" To iSuccess
    Send ComUpdateChildContent To hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|CNPJ" "token string"
    Send ComUpdateChildContent To hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|cLote" "string"
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature" True "Id" "?" To iSuccess
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo" True "Id" "?" To iSuccess
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:CanonicalizationMethod" True "Algorithm" "http://www.w3.org/TR/2001/REC-xml-c14n-20010315" To iSuccess
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:SignatureMethod" True "Algorithm" "http://www.w3.org/2000/09/xmldsig#rsa-sha1" To iSuccess
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference" True "Id" "?" To iSuccess
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference" True "URI" "?" To iSuccess
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference" True "Type" "?" To iSuccess
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform" True "Algorithm" "?" To iSuccess
    Send ComUpdateChildContent To hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform|ds:XPath" "string"
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestMethod" True "Algorithm" "http://www.w3.org/2000/09/xmldsig#sha1" To iSuccess
    Send ComUpdateChildContent To hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestValue" "BASE64_DATA"
    Send ComUpdateChildContent To hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignatureValue" "..."
    Get ComUpdateAttrAt Of hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo" True "Id" "?" To iSuccess
    Send ComUpdateChildContent To hoXml "soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509SubjectName" "string"
    Send ComUpdateChildContent To hoXml "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. 
    Set ComEmitXmlDecl Of hoXml To False
    Get ComGetXml Of hoXml To sSoapRequestBody

    Move "https://canoas-homol.infisc.com.br/services/nfse/ws/Servicos" To sEndpoint
    Move "" To sSoapAction
    //  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
    Move "text/xml" To sContentType

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    Send ComClearHeaders To hoHttp
    Send ComSetRequestHeader To hoHttp "Content-Type" sContentType
    Send ComSetRequestHeader To hoHttp "SOAPAction" sSoapAction

    Get ComPostXml Of hoHttp sEndpoint sSoapRequestBody "utf-8" To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed to send SOAP request."
        Procedure_Return
    End

    // Get the XML response body.
    Get Create (RefClass(cComChilkatXml)) To hoResponseXml
    If (Not(IsComObjectCreated(hoResponseXml))) Begin
        Send CreateComObject of hoResponseXml
    End
    Get pvComObject of hoResponseXml to vResponseXml
    Get ComGetBodyXml Of hoResp vResponseXml To iSuccess

    Get ComStatusCode Of hoResp To iStatusCode
    Showln "response status code: " iStatusCode

    Send Destroy of hoResp

    // If the status code does not indicate succcess, then show the response XML,
    // which probably contains error information.
    If (iStatusCode <> 200) Begin
        Get ComGetXml Of hoResponseXml To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get ComGetXml Of hoResponseXml To sTemp1
    Showln sTemp1

    // 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).

    Get ComGetAttrValue Of hoResponseXml "xmlns" To sEnvelope_xmlns
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|(versao)" To sConfirmaCancelamentoLote_versao
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|CNPJ" To sCNPJ
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|cLote" To sCLote
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|dhRecbto" To sDhRecbto
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|sit" To sSit
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|mot" To sMot
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|(Id)" To sSignature_Id
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|(Id)" To sSignedInfo_Id
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:CanonicalizationMethod|(Algorithm)" To sCanonicalizationMethod_Algorithm
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:SignatureMethod|(Algorithm)" To sSignatureMethod_Algorithm
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Id)" To sReference_Id
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(URI)" To sReference_URI
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Type)" To sReference_Type
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|(Algorithm)" To sTransform_Algorithm
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|*:XPath" To sXPath
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestMethod|(Algorithm)" To sDigestMethod_Algorithm
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestValue" To sDigestValue
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignatureValue" To sSignatureValue
    Get ComChilkatPath Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|(Id)" To sKeyInfo_Id
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|*:X509Data|*:X509SubjectName" To sX509SubjectName
    Get ComGetChildContent Of hoResponseXml "*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|*:X509Data|*:X509Certificate" To sX509Certificate


End_Procedure
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>