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
(Swift 3,4,5...) SOAP Request to fseservicetest.sanita.finanze.it with Basic AuthenticationDemonstrates sending a SOAP request to fseservicetest.sanita.finanze.it with Basic Authentication.
func chilkatTest() { // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. let http = CkoHttp()! let xml = CkoXml()! var success: Bool = false // Create the SOAP envelope... xml.tag = "soapenv:Envelope" xml.addAttribute("xmlns:soapenv", value: "http://schemas.xmlsoap.org/soap/envelope/") xml.addAttribute("xmlns:stat", value: "http://statoconsensirichiesta.xsd.fse.ini.finanze.it") xml.addAttribute("xmlns:tip", value: "http://tipodatistatoconsensi.xsd.fse.ini.finanze.it") xml.updateChildContent("soapenv:Header", value: "") xml.updateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoUtente", value: "XXXXXXAAABBBCCC") xml.updateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:pinCode", value: "...") xml.updateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoOrganizzazione", value: "999") xml.updateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:StrutturaUtente", value: "123456789") xml.updateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:RuoloUtente", value: "ZZZ") xml.updateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:ContestoOperativo", value: "") xml.updateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:IdentificativoAssistitoGenitoreTutore", value: "") xml.updateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:PresaInCarico", value: "true") xml.updateChildContent("soapenv:Body|stat:StatoConsensiRichiesta|stat:TipoAttivita", value: "READ") xml.updateChildContent("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("Content-Type", value: "application/soap+xml; charset=utf-8") req.path = path success = req.loadBody(from: soapEnvelope, charset: "utf-8") // User name and Password for Basic Authentication http.login = "XXXXXXAAABBBCCC" http.password = "MYPASSWORD" var resp: CkoHttpResponse? = http.synchronousRequest(domain, port: 443, ssl: true, req: req) if http.lastMethodSuccess == false { print("\(http.lastErrorText!)") return } let xmlResp = CkoXml()! success = xmlResp.load(resp!.bodyStr) print("\(xmlResp.getXml()!)") resp = nil } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.