【发布时间】:2015-10-21 05:39:34
【问题描述】:
我在我的 asp.net 应用程序http://www.webservicex.net/globalweather.asmx?op=GetWeather 中使用全球天气网络服务。
代码运行良好,但我只想在标签上显示温度。
ServiceReference1.GlobalWeatherSoapClient client = new ServiceReference1.GlobalWeatherSoapClient("GlobalWeatherSoap");
string weather = client.GetWeather("Karachi Airport", "Pakistan");
Label1.Text = weather;
标签控件显示服务提供的完整数据(即日期、时间、国家和城市名称等)
【问题讨论】:
-
您正在获取 XML 中的字符串?
-
Karachi Airport, Pakistan (OPKC) 24-54N 067-08E 22M Oct 21, 2015 - 01:25 AM EDT / 2015.10.21 0525 UTC from the E (100 degrees) at 6 MPH (5 KT):0 3 mile(s):0 91 F (33 C) 57 F (14 C) 31% 29.91 in. Hg (1013 hPa) Success -
在浏览器中连续上升。
-
您提供的链接以 XML 形式返回
-
它返回一个 XML。你可以把它放在
xmlDoc中,然后获取<Temperature>节点
标签: c# asp.net web-services