Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PureBasic) 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).
IncludeFile "CkCert.pb" IncludeFile "CkHttp.pb" IncludeFile "CkHttpResponse.pb" IncludeFile "CkXml.pb" IncludeFile "CkHttpRequest.pb" Procedure ChilkatExample() ; This example requires the Chilkat API to have been previously unlocked. ; See Global Unlock Sample for sample code. http.i = CkHttp::ckCreate() If http.i = 0 Debug "Failed to create object." ProcedureReturn EndIf xml.i = CkXml::ckCreate() If xml.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success.i = 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::setCkTag(xml, "soapenv:Envelope") CkXml::ckAddAttribute(xml,"xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/") CkXml::ckAddAttribute(xml,"xmlns:stat","http://statoconsensirichiesta.xsd.fse.ini.finanze.it") CkXml::ckAddAttribute(xml,"xmlns:tip","http://tipodatistatoconsensi.xsd.fse.ini.finanze.it") CkXml::ckUpdateChildContent(xml,"soapenv:Header","") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente","XXXXXXAAABBBCCC") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode","...") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione","999") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente","123456789") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente","ZZZ") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo","") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore","") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico","true") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita","READ") CkXml::ckUpdateChildContent(xml,"soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoConsenso","ABCDEFGHIJKLM") soapEnvelope.s = CkXml::ckGetXml(xml) domain.s = "fseservicetest.sanita.finanze.it" path.s = "/FseInsServicesWeb/services/fseStatoConsensi" req.i = CkHttpRequest::ckCreate() If req.i = 0 Debug "Failed to create object." ProcedureReturn EndIf CkHttpRequest::setCkHttpVerb(req, "POST") CkHttpRequest::setCkSendCharset(req, 0) CkHttpRequest::ckAddHeader(req,"Content-Type","application/soap+xml; charset=utf-8") CkHttpRequest::setCkPath(req, path) success = CkHttpRequest::ckLoadBodyFromString(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. cert.i = CkCert::ckCreate() If cert.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success = CkCert::ckLoadFromSmartcard(cert,"") If success = 0 Debug CkCert::ckLastErrorText(cert) CkHttp::ckDispose(http) CkXml::ckDispose(xml) CkHttpRequest::ckDispose(req) CkCert::ckDispose(cert) ProcedureReturn EndIf ; Tell the Chilkat HTTP object to use the certificate for client authentication. success = CkHttp::ckSetSslClientCert(http,cert) If success = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkXml::ckDispose(xml) CkHttpRequest::ckDispose(req) CkCert::ckDispose(cert) ProcedureReturn EndIf CkHttp::setCkTlsVersion(http, "TLS 1.1") resp.i = CkHttp::ckSynchronousRequest(http,domain,443,1,req) If CkHttp::ckLastMethodSuccess(http) = 0 Debug CkHttp::ckLastErrorText(http) CkHttp::ckDispose(http) CkXml::ckDispose(xml) CkHttpRequest::ckDispose(req) CkCert::ckDispose(cert) ProcedureReturn EndIf xmlResp.i = CkXml::ckCreate() If xmlResp.i = 0 Debug "Failed to create object." ProcedureReturn EndIf success = CkXml::ckLoadXml(xmlResp,CkHttpResponse::ckBodyStr(resp)) Debug CkXml::ckGetXml(xmlResp) CkHttpResponse::ckDispose(resp) CkHttp::ckDispose(http) CkXml::ckDispose(xml) CkHttpRequest::ckDispose(req) CkCert::ckDispose(cert) CkXml::ckDispose(xmlResp) ProcedureReturn EndProcedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.