简体   繁体   中英

how to get string array from response in nsurlconnction (of wcf web srvice)?

I created wcf soap service, which contains one method and it returns string array...

I call that service in ios(in xcode objective c) application, but it returns the response as xml.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><IMethodNameResponse xmlns="http://tempuri.org/">

how can i get string array from response result ?

You have several options here.

First one is to parse that XML with NSXMLParser . You need to know XML structure and create object for each XML document. This object must implement NSXMLParserDelegate protocol.

Another one is to use XPath to get exactly what you want from XML document. Here is XPath example . This doesn't require any third-party libraries to include in your project but if you OK with third-party, you could check this library and tutorial XML Tutorial for iOS .

And the last option is WCF itself. You could try to switch to JSON in WCF.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM