Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

b0yax

macrumors newbie
Original poster
Feb 24, 2010
6
0
Hi,

I can successfully connect and receive data from a SOAP web service.
but my problem now is that, how I can traverse with an XML schema parameter?
This is the sample soap XML result:
Code:
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetHotItemsResponse xmlns="http://www.mysite.com/WSMobileData/">
      <GetHotItemsResult>
        <xsd:schema>schema</xsd:schema>xml</GetHotItemsResult>
    </GetHotItemsResponse>
  </soap:Body>
</soap:Envelope>

Then, in my XML Parser delegate method I've check for this elementName: GetHotItemsResult
and parse to the data results..

Pls see the code here:
http://pastebin.com/zFAjyjvq

Console log:
Code:
2010-09-03 01:09:34.200 SoapSample[919:207] soapMessage: 
  <?xml version="1.0" encoding="utf-8"?>
     <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
             <soap:Body>
                 <GetHotItems xmlns="http://www.mysite.com/WSMobileData/" />
            </soap:Body>
      </soap:Envelope>

2010-09-03 01:09:34.203 SoapSample[919:207] theRequest: <NSMutableURLRequest http://www.mysite.com/WSMobileData/WSMobile.asmx>

2010-09-03 01:09:35.213 SoapSample[919:207] DONE. Received Bytes: 751

2010-09-03 01:09:35.214 SoapSample[919:207] theXML: 
  <?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>
              <GetHotItemsResponse xmlns="http://www.mysite.com/WSMobileData/"> <GetHotItemsResult>[["8","../images/DealExtreme/sku_37281_1_small.jpg","Genuine ANV DVD+R DL 2.4X 8.5GB 240-Min DVD Writable (10-Disc Spindle)","13.44"],["9","../images/DealExtreme/sku_4483_1_small.jpg","Mini DVD-R 10-Pack Spindle 1.4GB/30min 1~8X","8.56"],["10","../images/DealExtreme/sku_31906_1_small.jpg","Football Team Car Sun Visor CD/DVD Holder - Man Utd (Holds 13-Disc)","4.58"]]</GetHotItemsResult>
              </GetHotItemsResponse>
         </soap:Body>
    </soap:Envelope>

2010-09-03 01:09:35.215 SoapSample[919:207] soapResults: [["8","../images/DealExtreme/sku_37281_1_small.jpg","Genuine ANV DVD+R DL 2.4X 8.5GB 240-Min DVD Writable (10-Disc Spindle)","13.44"],["9","../images/DealExtreme/sku_4483_1_small.jpg","Mini DVD-R 10-Pack Spindle 1.4GB/30min 1~8X","8.56"],["10","../images/DealExtreme/sku_31906_1_small.jpg","Football Team Car Sun Visor CD/DVD Holder - Man Utd (Holds 13-Disc)","4.58"]]

How I can traverse it in xml and parse the data correctly?
Code:
<GetHotItemsResult>
   [
	["8","../images/DealExtreme/sku_37281_1_small.jpg","Genuine ANV DVD+R DL 2.4X 8.5GB 240-Min DVD Writable (10-Disc Spindle)","13.
        ["9","../images/DealExtreme/sku_4483_1_small.jpg","Mini DVD-R 10-Pack Spindle 1.4GB/30min 1~8X","8.56"],
	["10","../images/DealExtreme/sku_31906_1_small.jpg","Football Team Car Sun Visor CD/DVD Holder - Man Utd (Holds 13-Disc)","4.58"]
   ]
</GetHotItemsResult>
So, from this data I should extract it and saved it into an array then display it in tableview.

Anyone can give me some advise.
Thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.