开发者

How to parse soap request in iphone

I am trying to send a request to server with my soap request and trying to get the server response,so I got the server response eith many tags.. below is my server response

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetCustomersResponse xmlns="http://www.fashionize.ca/"><GetCustomersResult><Customer><ID>2</ID><No>LASEN</No><Name>La Senza</Na开发者_高级运维me><Add1>43221 Van Horn</Add1><Add2 /><LanguageCd>EN</LanguageCd><DateCreated>2011-08-16T09:33:00</DateCreated></Customer><Customer><ID>1</ID><No>THUND</No><Name>Thunder Bay</Name><Add1>1234 Miaw</Add1><Add2 /><LanguageCd>FR</LanguageCd><DateCreated>2011-08-16T09:33:00</DateCreated></Customer></GetCustomersResult></GetCustomersResponse></soap:Body></soap:Envelope>

Here as u can see it has many tags like customer name,add1,add2 so i want o know how to parse this..

Regards Ranjit


SOAP is pretty horrible to deal with, but not impossible. If you have the option to use JSON instead then that is a much better alternative.

Here is a great article on SOAP on iOS: http://blog.exadel.com/2011/03/working-with-ios-and-soap/


TRy http://sudzc.com/. It generates a code for you and be able to parse any Soap message very easily and quickly.


I've used wsdl2objc (http://code.google.com/p/wsdl2objc/) quite successfully. You'll have to set a compiler flag and add a build path, but otherwise it's pretty much hassle-free.


Please see the demo prepared for iOS/OSX using sample web service.

It uses swift - SOAP request creator & response parser.

DEMO

Done using Alamofire & SWXMLHash library

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜