0
这是我尝试使用的Web服务。我正在使用Visual Studio 2010. http://www.webservicex.net/country.asmx使用XML从Web服务调用国家/地区的货币名称
这是我的代码。我已将网络服务添加到我的网站,并且在我的环境中没有显示错误。当我运行程序并点击我的按钮时,然而,没有任何反应。
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Xml.XPath;
using System.Net;
using System.Web.Services.Protocols;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public void btnCountry_Click(object sender, EventArgs e)
{
CountryInfo.country country = new CountryInfo.country();
String countryName = txtCountry.Text;
String currencyName = country.GetCurrencyByCountry(countryName);
XPathNavigator nav;
XmlDocument myDoc = new XmlDocument();
myDoc.LoadXml(currencyName);
nav = myDoc.CreateNavigator();
lblCurrency.Text = nav.SelectSingleNode("//Currency").Value;
String countryCode = nav.SelectSingleNode("//CurrencyCode").Value;
}
}
任何帮助将不胜感激!