protected void Button1_Click(object sender, EventArgs e)
{
cn.com.webxml.www.WeatherWebService weather = new cn.com.webxml.www.WeatherWebService();
string[] weathers = weather.getWeatherbyCityName("58367");
this.TextBox1.Text = weathers[10].ToString();
cn.com.webxml.www.ChinaOpenFundWS fund = new cn.com.webxml.www.ChinaOpenFundWS();
DataSet ds= fund.getFundCodeNameDataSet();
this.GridView1.DataSource = ds.Tables[0].DefaultView;
this.GridView1.DataBind();
cn.com.webxml.www.ChinaStockSmallImageWS stock = new cn.com.webxml.www.ChinaStockSmallImageWS();
byte[] b = stock.getSmallImageByte("sh000001", byte.MaxValue);
Random random = new Random();
string imageName=random.Next().ToString()+ ".jpg";
string myUrl = HttpContext.Current.Server.MapPath(this.Request.ApplicationPath) + imageName;
FileStream fs = new FileStream(myUrl, FileMode.OpenOrCreate);
BinaryWriter w = new BinaryWriter(fs);
w.BaseStream.Write(b, 0, b.Length);
w.Flush();
w.Close();
this.Image1.ImageUrl = Context.Request.ApplicationPath + imageName;
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(myUrl);
this.Image1.Width = bitmap.Width;
this.Image1.Height = bitmap.Height;
}
给大家介绍一个很好的网站,提供了一些常用的web服务,例如时刻表,天气,基金,股票,IP等,大家可以自己去看看。{
cn.com.webxml.www.WeatherWebService weather = new cn.com.webxml.www.WeatherWebService();
string[] weathers = weather.getWeatherbyCityName("58367");
this.TextBox1.Text = weathers[10].ToString();
cn.com.webxml.www.ChinaOpenFundWS fund = new cn.com.webxml.www.ChinaOpenFundWS();
DataSet ds= fund.getFundCodeNameDataSet();
this.GridView1.DataSource = ds.Tables[0].DefaultView;
this.GridView1.DataBind();
cn.com.webxml.www.ChinaStockSmallImageWS stock = new cn.com.webxml.www.ChinaStockSmallImageWS();
byte[] b = stock.getSmallImageByte("sh000001", byte.MaxValue);
Random random = new Random();
string imageName=random.Next().ToString()+ ".jpg";
string myUrl = HttpContext.Current.Server.MapPath(this.Request.ApplicationPath) + imageName;
FileStream fs = new FileStream(myUrl, FileMode.OpenOrCreate);
BinaryWriter w = new BinaryWriter(fs);
w.BaseStream.Write(b, 0, b.Length);
w.Flush();
w.Close();
this.Image1.ImageUrl = Context.Request.ApplicationPath + imageName;
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(myUrl);
this.Image1.Width = bitmap.Width;
this.Image1.Height = bitmap.Height;
}
http://www.webxml.com.cn/zh_cn/web_services.aspx
下面我演示一个例子,获取天气,基金列表和股票走势图,具体的基金值需要联系网站,用他分配的用户名做参数才可以访问。