Swift
Swift
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 Swift Downloads
func chilkatTest() {
var success: Bool = false
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
let xml = CkoXml()!
success = false
// Create the SOAP envelope...
xml.tag = "soapenv:Envelope"
xml.addAttribute(name: "xmlns:soapenv", value: "http://schemas.xmlsoap.org/soap/envelope/")
xml.addAttribute(name: "xmlns:stat", value: "http://statoconsensirichiesta.xsd.fse.ini.finanze.it")
xml.addAttribute(name: "xmlns:tip", value: "http://tipodatistatoconsensi.xsd.fse.ini.finanze.it")
xml.updateChildContent(tagPath: "soapenv:Header", value: "")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente", value: "XXXXXXAAABBBCCC")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode", value: "...")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione", value: "999")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente", value: "123456789")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente", value: "ZZZ")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo", value: "")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore", value: "")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico", value: "true")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita", value: "READ")
xml.updateChildContent(tagPath: "soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoConsenso", value: "ABCDEFGHIJKLM")
var soapEnvelope: String? = xml.getXml()
var domain: String? = "fseservicetest.sanita.finanze.it"
var path: String? = "/FseInsServicesWeb/services/fseStatoConsensi"
let req = CkoHttpRequest()!
req.httpVerb = "POST"
req.sendCharset = false
req.addHeader(name: "Content-Type", value: "application/soap+xml; charset=utf-8")
req.path = path
success = req.loadBody(fromString: soapEnvelope, charset: "utf-8")
// User name and Password for Basic Authentication
http.login = "XXXXXXAAABBBCCC"
http.password = "MYPASSWORD"
let resp = CkoHttpResponse()!
success = http.httpSReq(domain: domain, port: 443, ssl: true, request: req, response: resp)
if success == false {
print("\(http.lastErrorText!)")
return
}
let xmlResp = CkoXml()!
success = xmlResp.load(xmlData: resp.bodyStr)
print("\(xmlResp.getXml()!)")
}