PureBasic
PureBasic
SOAP Request to fseservicetest.sanita.finanze.it with Basic Authentication
See more HTTP Misc Examples
Demonstrates sending a SOAP request to fseservicetest.sanita.finanze.it with Basic Authentication.Chilkat PureBasic Downloads
IncludeFile "CkHttpResponse.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkXml.pb"
IncludeFile "CkHttpRequest.pb"
Procedure ChilkatExample()
success.i = 0
; 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 = 0
; 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")
; User name and Password for Basic Authentication
CkHttp::setCkLogin(http, "XXXXXXAAABBBCCC")
CkHttp::setCkPassword(http, "MYPASSWORD")
resp.i = CkHttpResponse::ckCreate()
If resp.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success = CkHttp::ckHttpSReq(http,domain,443,1,req,resp)
If success = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkXml::ckDispose(xml)
CkHttpRequest::ckDispose(req)
CkHttpResponse::ckDispose(resp)
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)
CkHttp::ckDispose(http)
CkXml::ckDispose(xml)
CkHttpRequest::ckDispose(req)
CkHttpResponse::ckDispose(resp)
CkXml::ckDispose(xmlResp)
ProcedureReturn
EndProcedure