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
#import <CkoXml.h>
#import <NSString.h>
#import <CkoHttp.h>
#import <CkoHttpResponse.h>

CkoXml *xml = [[CkoXml alloc] init];
xml.Tag = @"soapenv:Envelope";
[xml AddAttribute: @"xmlns:soapenv" value: @"http://schemas.xmlsoap.org/soap/envelope/"];
[xml AddAttribute: @"xmlns" value: @"http://ws.pc.gif.com.br/"];
[xml AddAttribute: @"xmlns:nfs" value: @"http://nfse.abrasf.org.br"];
[xml AddAttribute: @"xmlns:ds" value: @"http://www.w3.org/2000/09/xmldsig#"];
[xml UpdateChildContent: @"soapenv:Header" value: @""];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote" autoCreate: YES attrName: @"versao" attrValue: @"?"];
[xml UpdateChildContent: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|CNPJ" value: @"token string"];
[xml UpdateChildContent: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|cLote" value: @"string"];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature" autoCreate: YES attrName: @"Id" attrValue: @"?"];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo" autoCreate: YES attrName: @"Id" attrValue: @"?"];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:CanonicalizationMethod" autoCreate: YES attrName: @"Algorithm" attrValue: @"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:SignatureMethod" autoCreate: YES attrName: @"Algorithm" attrValue: @"http://www.w3.org/2000/09/xmldsig#rsa-sha1"];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference" autoCreate: YES attrName: @"Id" attrValue: @"?"];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference" autoCreate: YES attrName: @"URI" attrValue: @"?"];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference" autoCreate: YES attrName: @"Type" attrValue: @"?"];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform" autoCreate: YES attrName: @"Algorithm" attrValue: @"?"];
[xml UpdateChildContent: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:Transforms|ds:Transform|ds:XPath" value: @"string"];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestMethod" autoCreate: YES attrName: @"Algorithm" attrValue: @"http://www.w3.org/2000/09/xmldsig#sha1"];
[xml UpdateChildContent: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignedInfo|ds:Reference|ds:DigestValue" value: @"BASE64_DATA"];
[xml UpdateChildContent: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:SignatureValue" value: @"..."];
[xml UpdateAttrAt: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo" autoCreate: YES attrName: @"Id" attrValue: @"?"];
[xml UpdateChildContent: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509SubjectName" value: @"string"];
[xml UpdateChildContent: @"soapenv:Body|cancelarLoteRequest|pedidoCancelamentoLote|ds:Signature|ds:KeyInfo|ds:X509Data|ds:X509Certificate" value: @"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.EmitXmlDecl = NO;
NSString *soapRequestBody = [xml GetXml];

NSString *endpoint = @"https://canoas-homol.infisc.com.br/services/nfse/ws/Servicos";
NSString *soapAction = @"";
//  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
NSString *contentType = @"text/xml";

CkoHttp *http = [[CkoHttp alloc] init];

[http ClearHeaders];
[http SetRequestHeader: @"Content-Type" value: contentType];
[http SetRequestHeader: @"SOAPAction" value: soapAction];

CkoHttpResponse *resp = [http PostXml: endpoint xmlDoc: soapRequestBody charset: @"utf-8"];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    NSLog(@"%@",@"Failed to send SOAP request.");
    return;
}

// Get the XML response body.
CkoXml *responseXml = [[CkoXml alloc] init];
[resp GetBodyXml: responseXml];

int statusCode = [resp.StatusCode intValue];
NSLog(@"%@%d",@"response status code: ",statusCode);

// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.
if (statusCode != 200) {
    NSLog(@"%@",[responseXml GetXml]);
    return;
}

NSLog(@"%@",[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).

NSString *Envelope_xmlns = [responseXml GetAttrValue: @"xmlns"];
NSString *confirmaCancelamentoLote_versao = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|(versao)"];
NSString *CNPJ = [responseXml GetChildContent: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|CNPJ"];
NSString *cLote = [responseXml GetChildContent: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|cLote"];
NSString *dhRecbto = [responseXml GetChildContent: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|dhRecbto"];
NSString *sit = [responseXml GetChildContent: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|sit"];
NSString *mot = [responseXml GetChildContent: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|mot"];
NSString *Signature_Id = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|(Id)"];
NSString *SignedInfo_Id = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|(Id)"];
NSString *CanonicalizationMethod_Algorithm = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:CanonicalizationMethod|(Algorithm)"];
NSString *SignatureMethod_Algorithm = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:SignatureMethod|(Algorithm)"];
NSString *Reference_Id = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Id)"];
NSString *Reference_URI = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(URI)"];
NSString *Reference_Type = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|(Type)"];
NSString *Transform_Algorithm = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|(Algorithm)"];
NSString *XPath = [responseXml GetChildContent: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:Transforms|*:Transform|*:XPath"];
NSString *DigestMethod_Algorithm = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestMethod|(Algorithm)"];
NSString *DigestValue = [responseXml GetChildContent: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignedInfo|*:Reference|*:DigestValue"];
NSString *SignatureValue = [responseXml GetChildContent: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:SignatureValue"];
NSString *KeyInfo_Id = [responseXml ChilkatPath: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|(Id)"];
NSString *X509SubjectName = [responseXml GetChildContent: @"*:Body|cancelarLoteResponse|confirmaCancelamentoLote|*:Signature|*:KeyInfo|*:X509Data|*:X509SubjectName"];
NSString *X509Certificate = [responseXml GetChildContent: @"*: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>