Hello, I am new to the Swift development world and would like to know what the best way (working sample code would be beneficial) to run a web service, particularly WSDL, and then parse the XML code for display? I've scoured the internet on examples of this, but there doesn't seem to be a whole lot of examples out there, and if there were, they were written in objective c.
Parsing WSDL Web Services
I have the same problem as well, a third party developer published a web service with its WSDL. I am trying to consume a method of the service. I used some testing tools and I know that web service is working as SOAPUi gives me expected results, but I cannot figure out how to develop a working SOAP call in Swift from the published web service and its WSDL.
Any help or example of how to consume web service through WSDL in Swift would be appreciated?
I have the same problem too, someone found a solution?
Hi
I have tried an example
import UIKit
class ViewController: UIViewController , NSXMLParserDelegate{
var is_SoapMessage: String = "<soapenv:Envelope xmlns:soapenv=\"http:/
/
var is_SoapMessage = "<?xml version='1.0' encoding='UTF-8'?><soap:Envelope xmlns:soap=' */
@IBAction func makeAction(sender: AnyObject) {
var lobj_Request = NSMutableURLRequest(URL: NSURL(string: is_URL)!)
var session = NSURLSession.sharedSession()
lobj_Request.HTTPMethod = "POST"
lobj_Request.HTTPBody = is_SoapMessage.dataUsingEncoding(NSUTF8StringEncoding)
lobj_Request.addValue("www.cgsapi.com", forHTTPHeaderField: "Host")
lobj_Request.addValue("text/xml; charset=utf-8", forHTTPHeaderField: "Content-Type")
lobj_Request.addValue(String(count(is_SoapMessage)), forHTTPHeaderField: "Content-Length")
println("Response: \(response)")
var strData = NSString(data: data, encoding: NSUTF8StringEncoding)
let parser = NSXMLParser(data: data)
println("Error: " + error.description)
if elementName == "GetSystemStatusResult" {
func parser(parser: NSXMLParser, foundCharacters string: String?) {
if elementName == "GetSystemStatusResult" {
println("this is right answer ")
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
it give complete parsing .
but this is asmx service I try to make an example wcf (svc)
Thanks
This is
var is_SoapMessage: String = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cgs=\"http://www.cgsapi.com/\"><soapenv:Header/><soapenv:Body><cgs:GetSystemStatus/></soapenv:Body></soapenv:Envelope>"
soap message of above example which need to match .
Found an answer from edwardmp on stackoverflow http://stackoverflow.com/questions/30739149/how-do-i-accept-a-self-signed-ssl-certificate-using-ios-7s-nsurlsessionand a example https://gist.github.com/edwardmp/df8517aa9f1752e73353 that worked. I struggled for awhile trying to get this