如何从 nsurlconnection(wcf web 服务)中的响应中获取字符串数组?
how to get string array from response in nsurlconnction (of wcf web srvice)?
我创建了 wcf soap 服务,它包含一个方法,它 returns 字符串数组...
我在 ios(在 xcode objective c)应用程序中调用该服务,但它 returns 响应为 xml。
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><IMethodNameResponse xmlns="http://tempuri.org/">
如何从响应结果中获取字符串数组?
这里有几个选项。
第一个是用 NSXMLParser
解析 XML。您需要了解 XML 结构并为每个 XML 文档创建对象。此对象必须实现 NSXMLParserDelegate
协议。
另一种方法是使用 XPath 从 XML 文档中准确获取您想要的内容。这里是 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.
最后一个选项是 WCF 本身。您可以尝试在 WCF 中切换到 JSON。
我创建了 wcf soap 服务,它包含一个方法,它 returns 字符串数组...
我在 ios(在 xcode objective c)应用程序中调用该服务,但它 returns 响应为 xml。
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><IMethodNameResponse xmlns="http://tempuri.org/">
如何从响应结果中获取字符串数组?
这里有几个选项。
第一个是用 NSXMLParser
解析 XML。您需要了解 XML 结构并为每个 XML 文档创建对象。此对象必须实现 NSXMLParserDelegate
协议。
另一种方法是使用 XPath 从 XML 文档中准确获取您想要的内容。这里是 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.
最后一个选项是 WCF 本身。您可以尝试在 WCF 中切换到 JSON。