DataFlex
DataFlex
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 DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Boolean iSuccess
Handle hoHttp
Handle hoXml
String sSoapEnvelope
String sDomain
String sPath
Variant vReq
Handle hoReq
Variant vCert
Handle hoCert
Variant vResp
Handle hoResp
Resp Handle hoXmlResp
String sTemp1
Move False To iSuccess
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Get Create (RefClass(cComChilkatHttp)) To hoHttp
If (Not(IsComObjectCreated(hoHttp))) Begin
Send CreateComObject of hoHttp
End
Get Create (RefClass(cComChilkatXml)) To hoXml
If (Not(IsComObjectCreated(hoXml))) Begin
Send CreateComObject of hoXml
End
Move False To iSuccess
// --------------------------------------------------------------------------------
// 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...
Set ComTag Of hoXml To "soapenv:Envelope"
Get ComAddAttribute Of hoXml "xmlns:soapenv" "http://schemas.xmlsoap.org/soap/envelope/" To iSuccess
Get ComAddAttribute Of hoXml "xmlns:stat" "http://statoconsensirichiesta.xsd.fse.ini.finanze.it" To iSuccess
Get ComAddAttribute Of hoXml "xmlns:tip" "http://tipodatistatoconsensi.xsd.fse.ini.finanze.it" To iSuccess
Send ComUpdateChildContent To hoXml "soapenv:Header" ""
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente" "XXXXXXAAABBBCCC"
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode" "..."
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione" "999"
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente" "123456789"
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente" "ZZZ"
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo" ""
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore" ""
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico" "true"
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita" "READ"
Send ComUpdateChildContent To hoXml "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoConsenso" "ABCDEFGHIJKLM"
Get ComGetXml Of hoXml To sSoapEnvelope
Move "fseservicetest.sanita.finanze.it" To sDomain
Move "/FseInsServicesWeb/services/fseStatoConsensi" To sPath
Get Create (RefClass(cComChilkatHttpRequest)) To hoReq
If (Not(IsComObjectCreated(hoReq))) Begin
Send CreateComObject of hoReq
End
Set ComHttpVerb Of hoReq To "POST"
Set ComSendCharset Of hoReq To False
Send ComAddHeader To hoReq "Content-Type" "application/soap+xml; charset=utf-8"
Set ComPath Of hoReq To sPath
Get ComLoadBodyFromString Of hoReq sSoapEnvelope "utf-8" To iSuccess
// 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.
Get Create (RefClass(cComChilkatCert)) To hoCert
If (Not(IsComObjectCreated(hoCert))) Begin
Send CreateComObject of hoCert
End
Get ComLoadFromSmartcard Of hoCert "" To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoCert To sTemp1
Showln sTemp1
Procedure_Return
End
// Tell the Chilkat HTTP object to use the certificate for client authentication.
Get pvComObject of hoCert to vCert
Get ComSetSslClientCert Of hoHttp vCert To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Set ComTlsVersion Of hoHttp To "TLS 1.1"
Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
If (Not(IsComObjectCreated(hoResp))) Begin
Send CreateComObject of hoResp
End
Get pvComObject of hoReq to vReq
Get pvComObject of hoResp to vResp
Get ComHttpSReq Of hoHttp sDomain 443 True vReq vResp To iSuccess
If (iSuccess = False) Begin
Get ComLastErrorText Of hoHttp To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatXml)) To hoXmlResp
If (Not(IsComObjectCreated(hoXmlResp))) Begin
Send CreateComObject of hoXmlResp
End
Get ComBodyStr Of hoResp To sTemp1
Get ComLoadXml Of hoXmlResp sTemp1 To iSuccess
Get ComGetXml Of hoXmlResp To sTemp1
Showln sTemp1
End_Procedure