Chilkat Examples

ChilkatHOMEAndroid™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi DLLGoJavaNode.jsObjective-CPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwiftTclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Objective-C Web API Examples
Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
Datev
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lemon Squeezy
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois
Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
UPS
UniPin
Verifactu
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Objective-C) Create SOAP with multiple VeriFactu Digitally Signed Registration Records

See more Verifactu Examples
Creates a SOAP message containing a multiple digitally signed invoice registration records, formatted according to the specifications for Spain's Veri*Factu system.

Chilkat Objective-C Library Downloads

MAC OS X (Cocoa) Libs

iOS Libs

#import <CkoXml.h>
#import <CkoStringBuilder.h>

BOOL success = NO;

success = YES;

// Begin with the following SOAP XML:

// <?xml version="1.0" encoding="utf-8"?>
// <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sum="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd" xmlns:sum1="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd" xmlns:xd="http://www.w3.org/2000/09/xmldsig#">
//     <soapenv:Header/>
//     <soapenv:Body>
//         <sum:RegFactuSistemaFacturacion>
//             <sum:Cabecera>
//                 <sum1:ObligadoEmision>
//                     <sum1:NombreRazon>XYZ STORE SL</sum1:NombreRazon>
//                     <sum1:NIF>B99999999</sum1:NIF>
//                 </sum1:ObligadoEmision>
//                 <sum1:RemisionRequerimiento>
//                     <sum1:RefRequerimiento>3333333333</sum1:RefRequerimiento>
//                     <sum1:FinRequerimiento>S</sum1:FinRequerimiento>
//                 </sum1:RemisionRequerimiento>
//             </sum:Cabecera>
// 
//         </sum:RegFactuSistemaFacturacion>
//     </soapenv:Body>
// </soapenv:Envelope>

CkoXml *xml = [[CkoXml alloc] init];
xml.Tag = @"soapenv:Envelope";
[xml AddAttribute: @"xmlns:soapenv" value: @"http://schemas.xmlsoap.org/soap/envelope/"];
[xml AddAttribute: @"xmlns:sum" value: @"https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroLR.xsd"];
[xml AddAttribute: @"xmlns:sum1" value: @"https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/tike/cont/ws/SuministroInformacion.xsd"];
[xml AddAttribute: @"xmlns:xd" value: @"http://www.w3.org/2000/09/xmldsig#"];
[xml UpdateChildContent: @"soapenv:Header" value: @""];
[xml UpdateChildContent: @"soapenv:Body|sum:RegFactuSistemaFacturacion|sum:Cabecera|sum1:ObligadoEmision|sum1:NombreRazon" value: @"XYZ STORE SL"];
[xml UpdateChildContent: @"soapenv:Body|sum:RegFactuSistemaFacturacion|sum:Cabecera|sum1:ObligadoEmision|sum1:NIF" value: @"B99999999"];
[xml UpdateChildContent: @"soapenv:Body|sum:RegFactuSistemaFacturacion|sum:Cabecera|sum1:RemisionRequerimiento|sum1:RefRequerimiento" value: @"3333333333"];
[xml UpdateChildContent: @"soapenv:Body|sum:RegFactuSistemaFacturacion|sum:Cabecera|sum1:RemisionRequerimiento|sum1:FinRequerimiento" value: @"S"];

// Prior to this code, we created N signed SOAP messages, each containing a single signed record.
// Load each of these signed SOAP messages into a StringBuilder and insert after the "</sum:Cabecera>"
// Note: We must NOT use Chilkat.Xml for this.  We must do string operations using Chilkat StringBuilder to prevent whitespace or formatting modifications which would break the signatures.

CkoStringBuilder *sbXml = [[CkoStringBuilder alloc] init];
[xml GetXmlSb: sbXml];

// ---------------------------------------------------------------------------------------------
// Load the previously signed XML containing just one signed record.
CkoStringBuilder *sbSignedSoap = [[CkoStringBuilder alloc] init];
success = [sbSignedSoap LoadFile: @"c:/temp/qa_output/signedSoapXml1.xml" charset: @"utf-8"];
if (success == NO) {
    NSLog(@"%@",sbSignedSoap.LastErrorText);
    return;
}

// Remove everything before "</sum:Cabecera>", including the "</sum:Cabecera>"
[sbSignedSoap RemoveBefore: @"</sum:Cabecera>"];

// Remove everything after the "</sum:RegFactuSistemaFacturacion>", including the "</sum:RegFactuSistemaFacturacion>"
[sbSignedSoap RemoveAfterFinal: @"</sum:RegFactuSistemaFacturacion>"];

// We now have the portion of the signed SOAP xml from <sum:RegistroFactura> to </sum:RegistroFactura>
// Insert it after the </sum:Cabecera>
[sbSignedSoap Prepend: @"</sum:Cabecera>"];
[sbXml ReplaceFirst: @"</sum:Cabecera>" replacement: [sbSignedSoap GetAsString]];

// ---------------------------------------------------------------------------------------------
// Add the next signed SOAP containing a single signed record.
success = [sbSignedSoap LoadFile: @"c:/temp/qa_output/signedSoapXml2.xml" charset: @"utf-8"];
if (success == NO) {
    NSLog(@"%@",sbSignedSoap.LastErrorText);
    return;
}

// Remove everything before "</sum:Cabecera>", including the "</sum:Cabecera>"
[sbSignedSoap RemoveBefore: @"</sum:Cabecera>"];

// Remove everything after the "</sum:RegFactuSistemaFacturacion>", including the "</sum:RegFactuSistemaFacturacion>"
[sbSignedSoap RemoveAfterFinal: @"</sum:RegFactuSistemaFacturacion>"];

// We now have the portion of the signed SOAP xml from <sum:RegistroFactura> to </sum:RegistroFactura>
// Insert it after the </sum:Cabecera>
[sbSignedSoap Prepend: @"</sum:Cabecera>"];
[sbXml ReplaceFirst: @"</sum:Cabecera>" replacement: [sbSignedSoap GetAsString]];

// ---------------------------------------------------------------------------------------------
// Continue adding more signed records if needed.

// Save the SOAP containing multiple signed records..
[sbXml WriteFile: @"c:/temp/qa_output/soap_combined.xml" charset: @"utf-8" emitBom: NO];
 

© 2000-2025 Chilkat Software, Inc. All Rights Reserved.