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 2) 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.LoadBodyFromString(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.LoadXml(resp!.BodyStr) print("\(xmlResp.GetXml())") resp = nil } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.