Hi,
I am having trouble figuring out how to use the response from a web service which returns a list of cities from a given country.
The Web Service I am using is --> http://www.webservicex.net/globalweather.asmx?op=GetCitiesByCountry
When entering Ireland this is the result:
I am trying to figure out how to run through this list and display it in a Windows Form Application.
The application is just a simple text field where I enter the name of the country, a button and a label which is suppose to show the cities.
I just can't figure out how to run over the list. Is there a clever way? I am just thinking about doing something with Regex or something like that, but there has to be a much easier and cleaner way of doing it. There has to be a way to list out the content between the city tags, but I just keep finding XML examples and when playing around with the examples where I create a Xmldocument and using the load method doesn't work for me.
A big problem is that I don't know what to Google for to find help or a solution.
Could you guys take a look at this and help me out by either showing me, pointing me in the right direction or tell me what to use / Google for?
I am having trouble figuring out how to use the response from a web service which returns a list of cities from a given country.
The Web Service I am using is --> http://www.webservicex.net/globalweather.asmx?op=GetCitiesByCountry
When entering Ireland this is the result:
C#:
<string xmlns="http://www.webserviceX.NET">
<NewDataSet> <Table> <Country>Ireland</Country> <City>Cork Airport</City> </Table> <Table> <Country>Ireland</Country> <City>Dublin Airport</City> </Table> <Table> <Country>Ireland</Country> <City>Casement Aerodrome</City> </Table> <Table> <Country>Ireland</Country> <City>Shannon Airport</City> </Table> </NewDataSet>
</string>
I am trying to figure out how to run through this list and display it in a Windows Form Application.
The application is just a simple text field where I enter the name of the country, a button and a label which is suppose to show the cities.
I just can't figure out how to run over the list. Is there a clever way? I am just thinking about doing something with Regex or something like that, but there has to be a much easier and cleaner way of doing it. There has to be a way to list out the content between the city tags, but I just keep finding XML examples and when playing around with the examples where I create a Xmldocument and using the load method doesn't work for me.
A big problem is that I don't know what to Google for to find help or a solution.
Could you guys take a look at this and help me out by either showing me, pointing me in the right direction or tell me what to use / Google for?
C#:
private void button1_Click(object sender, EventArgs e)
{
CitiesByCountryWebService.GlobalWeatherSoapClient cityClient = new CitiesByCountryWebService.GlobalWeatherSoapClient();
var response = cityClient.GetCitiesByCountry(txtBxCountry.Text);
}