Xbase++
Xbase++
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 Xbase++ Downloads
LOCAL nSuccess
LOCAL oHttp
LOCAL oXml
LOCAL cSoapEnvelope
LOCAL cDomain
LOCAL cPath
LOCAL oReq
LOCAL oCert
LOCAL oResp
LOCAL oXmlResp
nSuccess := 0
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
oHttp := CreateObject("Chilkat.Http")
oXml := CreateObject("Chilkat.Xml")
nSuccess := 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...
oXml:Tag := "soapenv:Envelope"
oXml:AddAttribute("xmlns:soapenv", "http://schemas.xmlsoap.org/soap/envelope/")
oXml:AddAttribute("xmlns:stat", "http://statoconsensirichiesta.xsd.fse.ini.finanze.it")
oXml:AddAttribute("xmlns:tip", "http://tipodatistatoconsensi.xsd.fse.ini.finanze.it")
oXml:UpdateChildContent("soapenv:Header", "")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente", "XXXXXXAAABBBCCC")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode", "...")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione", "999")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente", "123456789")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente", "ZZZ")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo", "")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore", "")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico", "true")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita", "READ")
oXml:UpdateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoConsenso", "ABCDEFGHIJKLM")
cSoapEnvelope := oXml:GetXml()
cDomain := "fseservicetest.sanita.finanze.it"
cPath := "/FseInsServicesWeb/services/fseStatoConsensi"
oReq := CreateObject("Chilkat.HttpRequest")
oReq:HttpVerb := "POST"
oReq:SendCharset := 0
oReq:AddHeader("Content-Type", "application/soap+xml; charset=utf-8")
oReq:Path := cPath
nSuccess := oReq:LoadBodyFromString(cSoapEnvelope, "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.
oCert := CreateObject("Chilkat.Cert")
nSuccess := oCert:LoadFromSmartcard("")
IF (nSuccess == 0)
? oCert:LastErrorText
oHttp:destroy()
oXml:destroy()
oReq:destroy()
oCert:destroy()
RETURN
ENDIF
// Tell the Chilkat HTTP object to use the certificate for client authentication.
nSuccess := oHttp:SetSslClientCert(oCert)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oXml:destroy()
oReq:destroy()
oCert:destroy()
RETURN
ENDIF
oHttp:TlsVersion := "TLS 1.1"
oResp := CreateObject("Chilkat.HttpResponse")
nSuccess := oHttp:HttpSReq(cDomain, 443, 1, oReq, oResp)
IF (nSuccess == 0)
? oHttp:LastErrorText
oHttp:destroy()
oXml:destroy()
oReq:destroy()
oCert:destroy()
oResp:destroy()
RETURN
ENDIF
oXmlResp := CreateObject("Chilkat.Xml")
nSuccess := oXmlResp:LoadXml(oResp:BodyStr)
? oXmlResp:GetXml()
oHttp:destroy()
oXml:destroy()
oReq:destroy()
oCert:destroy()
oResp:destroy()
oXmlResp:destroy()