Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Tcl Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl

 

 

 

(Tcl) SOAP Request to fseservicetest.sanita.finanze.it with Smart Card Authentication (TS-CNS Italian Card)

Demonstrates sending a SOAP request to fseservicetest.sanita.finanze.it with Smart Card (TS-CNS Italian Card).

Chilkat Tcl Extension Downloads

Chilkat Tcl Extension Downloads

load ./chilkat.dll

# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.

set http [new_CkHttp]

set xml [new_CkXml]

set success 0

# --------------------------------------------------------------------------------
# Also see Chilkat's Online WSDL Code Generator
# to generate code and SOAP Request and Response XML for each operation in a WSDL.
# --------------------------------------------------------------------------------

# Create the SOAP envelope...
CkXml_put_Tag $xml "soapenv:Envelope"
CkXml_AddAttribute $xml "xmlns:soapenv" "http://schemas.xmlsoap.org/soap/envelope/"
CkXml_AddAttribute $xml "xmlns:stat" "http://statoconsensirichiesta.xsd.fse.ini.finanze.it"
CkXml_AddAttribute $xml "xmlns:tip" "http://tipodatistatoconsensi.xsd.fse.ini.finanze.it"
CkXml_UpdateChildContent $xml "soapenv:Header" ""
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente" "XXXXXXAAABBBCCC"
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode" "..."
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione" "999"
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente" "123456789"
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente" "ZZZ"
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo" ""
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore" ""
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico" "true"
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita" "READ"
CkXml_UpdateChildContent $xml "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoConsenso" "ABCDEFGHIJKLM"
set soapEnvelope [CkXml_getXml $xml]

set domain "fseservicetest.sanita.finanze.it"
set path "/FseInsServicesWeb/services/fseStatoConsensi"

set req [new_CkHttpRequest]

CkHttpRequest_put_HttpVerb $req "POST"
CkHttpRequest_put_SendCharset $req 0
CkHttpRequest_AddHeader $req "Content-Type" "application/soap+xml; charset=utf-8"
CkHttpRequest_put_Path $req $path
set success [CkHttpRequest_LoadBodyFromString $req $soapEnvelope "utf-8"]

# Load the default certificate from the smartcard currently in the reader.
# (This assumes only one reader with one smartcard containing one certificate.
# If the situation is more complex, you can do it with Chilkat, but it requires
# using the Chilkat certificate store object to get the desired certificate
# from the desired smart card.)
# 
# Note: This is for Windows-only.
set cert [new_CkCert]

set success [CkCert_LoadFromSmartcard $cert ""]
if {$success == 0} then {
    puts [CkCert_lastErrorText $cert]
    delete_CkHttp $http
    delete_CkXml $xml
    delete_CkHttpRequest $req
    delete_CkCert $cert
    exit
}

# Tell the Chilkat HTTP object to use the certificate for client authentication.
set success [CkHttp_SetSslClientCert $http $cert]
if {$success == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkXml $xml
    delete_CkHttpRequest $req
    delete_CkCert $cert
    exit
}

CkHttp_put_TlsVersion $http "TLS 1.1"

# resp is a CkHttpResponse
set resp [CkHttp_SynchronousRequest $http $domain 443 1 $req]
if {[CkHttp_get_LastMethodSuccess $http] == 0} then {
    puts [CkHttp_lastErrorText $http]
    delete_CkHttp $http
    delete_CkXml $xml
    delete_CkHttpRequest $req
    delete_CkCert $cert
    exit
}

set xmlResp [new_CkXml]

set success [CkXml_LoadXml $xmlResp [CkHttpResponse_bodyStr $resp]]
puts [CkXml_getXml $xmlResp]
delete_CkHttpResponse $resp


delete_CkHttp $http
delete_CkXml $xml
delete_CkHttpRequest $req
delete_CkCert $cert
delete_CkXml $xmlResp

 

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