I have this function in Swift iOS using SOAPEngine to get the response:
func testLogin() {
//working url
var urlString = "http://192.168.1.3/magento/api/v2_soap/"
let url = NSURL(string: urlString)
var client = SOAPEngine()
client.userAgent = "SOAPEngine"
client.actionNamespaceSlash = true
client.version = VERSION_1_1
client.setValue("joemar", forKey: "username")
client.setValue("NewAPIKey", forKey: "apiKey")
client.setValue("urn:Magento", forKey: "namespace")
client.requestURL(url, soapAction: "login", completeWithDictionary: { (statusCode : Int, response : [NSObject : AnyObject]!) -> Void in
client = SOAPEngine()
client.userAgent = "SOAPEngine"
client.actionNamespaceSlash = true
client.version = VERSION_1_1
let sessionId : AnyObject? = response
client.setValue(sessionId, forKey: "sessionId")
client.requestURL(url, soapAction: "customerCustomerList", completeWithDictionary: { (statusCode : Int, response : [NSObject : AnyObject]!) -> Void in
let data : AnyObject? = response
}, failWithError: { (error : NSError!) -> Void in
println("failed!")
})
}) { (error : NSError!) -> Void in
println("failed!")
}
}
However, the 'completeWithDictionary' is always empty. I have used exactly the same function in Android and it was working fine. Android was using ksoap2 library. Please help. Thanks.