I am using both Rest & Soap API in my iOS application .For Rest API I can easily use Alamofire for both POST & GET method .But in Case of SOAP ,I am not able to handle the XML response .
Parse SOAP API using Alamofire and SWXMLHash Libraries easy to use for parsing : -
//MARK:- Parsing API here
func parseMyApi(is_URL: String, completion: (result: String) -> Void) {
Alamofire.request(.GET, is_URL)
.responseJSON { response in
let xmls = SWXMLHash.parse(response.data!)
func enumerate(indexer: XMLIndexer, level: Int) {
for child in indexer.children {
let name:String? = child.element!.name
print("\(level) \(name)")
// Take Link from XML data here
if name! == "link" {
let text = child.element!.text
if text?.isEmpty == false{
print(text)
// Finish here Process
completion(result: text!)
}
}
enumerate(child, level: level + 1)
}
}
enumerate(xmls, level: 0)
}
}
}
And you can see this example also for Soap parsing.