我是 silverlight 新手,在连接 Web 服务时遇到问题:wsf.cdyne.com/WeatherWS/Weather.asmx。我不确定最简单的方法是什么,互联网上的每个教程都将我引向了一个新的方向。有人可以简单介绍一下我必须做些什么才能将 xml 数据导入我的 silverlight 项目吗?
非常感谢!
到目前为止,我的 silverlight 项目中引用了 Web 服务,并且:
public MainPage()
{
InitializeComponent();
ServiceReference1.WeatherSoapClient service = new ServiceReference1.WeatherSoapClient();
service.GetCityForecastByZIPCompleted += new EventHandler<ServiceReference1.GetCityForecastByZIPCompletedEventArgs>(service_GetCityForecastByZIPCompleted);
service.GetCityForecastByZIPAsync("54481");
}
public void service_GetCityForecastByZIPCompleted(object sender, ServiceReference1.GetCityForecastByZIPCompletedEventArgs e)
{
MessageBox.Show("done: " + e.Result);
}
但 e.result 只返回“Lab_09.ServiceRe3ference1.ForecastReturn”