-
-
Notifications
You must be signed in to change notification settings - Fork 75
Improve the performance (Swift)
Danilo edited this page Jun 7, 2020
·
3 revisions
We know that the framework is not very fast at decoding very long and complex SOAP messages, we are working to optimize it, in the meantime is possible to customize the parsing of the data received with this basic example:
import UIKit
import SOAPEngine64
import UTXMLDictionary // https://github.com/ungacy/UTXMLDictionary
class ViewController: UIViewController, SOAPEngineDelegate {
override func viewDidLoad() {
super.viewDidLoad()
let soap = SOAPEngine()
soap.responseHeader = true
soap.actionNamespaceSlash = true
soap.delegate = self
soap.setValue("Genesis", forKey: "BookName")
soap.setIntegerValue(1, forKey: "chapter")
soap.requestURL("http://www.prioregroup.com/services/americanbible.asmx",
soapAction: "http://www.prioregroup.com/GetVerses")
}
func soapEngine(_ soapEngine: SOAPEngine!, didBeforeParsingResponseData data: Data!) -> Data! {
let dict = UTXMLDictionary.dictionary(fromXMLData: data) as! [String : AnyObject]
debugPrint(dict)
return nil
}
func soapEngine(_ soapEngine: SOAPEngine!, didFailWithError error: Error!) {
debugPrint(error)
}
}