zoukankan
html css js c++ java
使用webservice获得天气,基金,股票等信息 Virus
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等,大家可以自己去看看。
http://www.webxml.com.cn/zh_cn/web_services.aspx
下面我演示一个例子,获取天气,基金列表和股票走势图,具体的基金值需要联系网站,用他分配的用户名做参数才可以访问。
【Blog】
http://virusswb.cnblogs.com/
【MSN】
jorden008@hotmail.com
【说明】转载请标明出处,谢谢
反馈文章质量,你可以通过快速通道评论:
查看全文
相关阅读:
Facebook的体系结构分析---外文转载
简易的IOS位置定位服务
【简易版】IOS仿periscope自制狂赞飘桃心
The Linux Programming Interface
freeswitch嵌入lua脚本
Epoll Tutorial – epoll In 3 Easy Steps!
基于freeswitch的webrtc与sip终端呼叫
buildroot添加第三方库
rfc
TCP/UDP Server-Client implementation in C
原文地址:https://www.cnblogs.com/virusswb/p/1205025.html
最新文章
Qt信号和槽机制
Qt 中用QProcess调用cmd命令
Qt 程序获取程序所在路径、用户目录路径、临时文件夹等特殊路径的方法
前端性能优化
浏览器缓存
WebSocket
利用netsh命令设置IP地址/DNS服务器地址
JavaScript中的 && 和 ||
dependencies与devDependencies之间的区别
div与焦点事件
热门文章
npm scripts
CommonJS、AMD、CMD、ES6——JavaScript模块化
Electron
audacity开源VS2013环境搭建
speex进行音频去噪
C++类成员函数的重载、覆盖和隐藏区别?
arc如何破循环或交叉引用
ARC的原理详解
【转载国外好文】代工开发一个iOS应用没有那么容易
nginx服务傻瓜搭建
Copyright © 2011-2022 走看看