Hello all, i'm trying to split a soap response from a webservice but can't find the way to do it.
After googling for hours, i let my question here.
Here is my code:
Ti.include('suds.js'); var win = Ti.UI.createWindow({ backgroundColor : '#ffffff' }); var view = Ti.UI.createScrollView({ layout: 'Vertical', contentHeight:'auto' }); var label = Ti.UI.createLabel({ color : '#000000' }); var url = "http://www.webservicex.net/globalweather.asmx"; var callParams = { CountryName : 'belgium' }; var suds = new SudsClient({ endpoint : url, targetNamespace : 'http://www.webserviceX.NET' }); suds.invoke('GetCitiesByCountry', callParams, function(xmlDoc) { var response = xmlDoc.documentElement.getElementsByTagName('GetCitiesByCountryResult'); if (response && response.length > 0) { label.text = response.item(0).text; } else { label.text = 'NOT OK'; } }); view.add(label); win.add(view); win.open();In that case, i get a low reponse with a list of cities included into a country.
the xml response is something like this :
<NewDataSet> <Table> <Country>Belgium</Country> <City>Antwerpen</City> </Table> <Table> <Country>Belgium</Country> <City>Beauvechain</city> </Table> </NewDataSet>But i can't split those information. If i'd like to display a specific City, i don't know how to proceed.
The response.length = 1
If i try to change the var response = xmlDoc.documentElement.getElementsByTagName('GetCitiesByCountryResult') with something like getElementsByTagName('Table') the response.length = 0
What can i do please? :)