Tcl
Tcl
SOAP Request to fseservicetest.sanita.finanze.it with Smart Card Authentication (TS-CNS Italian Card)
See more HTTP Misc Examples
Demonstrates sending a SOAP request to fseservicetest.sanita.finanze.it with Smart Card (TS-CNS Italian Card).Chilkat Tcl Downloads
load ./chilkat.dll
set success 0
# 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"
set resp [new_CkHttpResponse]
set success [CkHttp_HttpSReq $http $domain 443 1 $req $resp]
if {$success == 0} then {
puts [CkHttp_lastErrorText $http]
delete_CkHttp $http
delete_CkXml $xml
delete_CkHttpRequest $req
delete_CkCert $cert
delete_CkHttpResponse $resp
exit
}
set xmlResp [new_CkXml]
set success [CkXml_LoadXml $xmlResp [CkHttpResponse_bodyStr $resp]]
puts [CkXml_getXml $xmlResp]
delete_CkHttp $http
delete_CkXml $xml
delete_CkHttpRequest $req
delete_CkCert $cert
delete_CkHttpResponse $resp
delete_CkXml $xmlResp