===========================? 天气预报查询==========================
--------WebTianQi.aspx前台------------
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
Xonselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
<asp:Button ID="btnChaKan" runat="server" Xonclick="btnChaKan_Click" Text="查看" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
---------WebTianQi.aspx-后台------------
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
cn.com.webxml.www.WeatherWebService weather = new
cn.com.webxml.www.WeatherWebService();
this.DropDownList1.DataSource=weather.getSupportProvince();
this.DropDownList1.DataBind();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
cn.com.webxml.www.WeatherWebService weather = new cn.com.webxml.www.WeatherWebService();
BindCity(weather);
}
private void BindCity(cn.com.webxml.www.WeatherWebService weather)
{
this.DropDownList2.Items.Clear();
string[] strs = weather.getSupportCity(this.DropDownList1.SelectedValue);
foreach (string item in strs)
{
DropDownList2.Items.Add(new ListItem(item.Substring(0, item.IndexOf("("))));
}
}
protected void btnChaKan_Click(object sender, EventArgs e)
{
cn.com.webxml.www.WeatherWebService weather = new cn.com.webxml.www.WeatherWebService();
string[] strs=weather.getWeatherbyCityName(this.DropDownList2.SelectedValue);
this.Label1.Text = strs[0] + ":"+strs[1] + ":<br/>";
this.Label1.Text += "气温:" + strs[5] + ";风向和风力:" + strs[7];
}
=================? 列车时刻表查询 ===============================
------------WebLieCheShiKeBiao.aspx前台------
<body>
<form id="form1" runat="server">
<div>
<br />
发车站:<asp:TextBox ID="txtFaCheZhan" runat="server"></asp:TextBox>
<br />
到达站:<asp:TextBox ID="txtDaoDaZhan" runat="server"></asp:TextBox>
<br />
UserId:<asp:TextBox ID="txtUserId" runat="server"></asp:TextBox>
<span>商业用户ID(普通用户不需要)</span><br />
<asp:Button ID="btnChaXun" runat="server" Xonclick="btnChaXun_Click" Text="查询" />
<br />
<br />
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
</body>
-----------WebLieCheShiKeBiao.aspx.cs后台-----------------
protected void btnChaXun_Click(object sender, EventArgs e)
{
cn.com.webxml.www1.TrainTimeWebService train = new
cn.com.webxml.www1.TrainTimeWebService();
DataSet ds=train.getStationAndTimeByStationName(txtFaCheZhan.Text, txtDaoDaZhan.Text,
txtUserId.Text);
this.GridView1.DataSource = ds;
this.GridView1.DataBind();
}
==========================? 电话号码查询 ==========================
--------WebDianHuaHaoMa.aspx前台----------
<body>
<form id="form1" runat="server">
<div>
请输入手机号码:<asp:TextBox ID="txtHaoMa" runat="server"></asp:TextBox>
<br />
userID:<asp:TextBox ID="txtUserId" runat="server"></asp:TextBox>
<span>商业用户ID不用填写<br />
</span>
<asp:Button ID="btnChaXun" runat="server" Xonclick="btnChaXun_Click" Text="查询" />
<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
</div>
</form>
</body>
--------WebDianHuaHaoMa.aspx.cs后台-------
protected void btnChaXun_Click(object sender, EventArgs e)
{
cn.com.webxml.webservice.MobileCodeWS mobile = new cn.com.webxml.webservice.MobileCodeWS
();
Label1.Text= mobile.getMobileCodeInfo(txtHaoMa.Text, txtUserId.Text);
}
==========================? 中英文翻译==========================
------WebZhongYingWenFanYi.aspx前台------------------------
<body>
<form id="form1" runat="server">
<div>
请输入英文或中文:<asp:TextBox ID="txtWord" runat="server"></asp:TextBox>
<asp:Button ID="btnFanYi" runat="server" Text="翻译" Xonclick="btnFanYi_Click" />
<br />
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
</div>
</form>
</body>
------WebZhongYingWenFanYi.aspx.cs后台------------------------
protected void btnFanYi_Click(object sender, EventArgs e)
{
cn.com.webxml.www2.TranslatorWebService translator = new
cn.com.webxml.www2.TranslatorWebService();
string[] strs=translator.getEnCnTwoWayTranslator(txtWord.Text);
Label1.Text = strs[0] + ";" + strs[1];
}
==========================? 验证码图片==========================
--------WebYanZhengMa.aspx前台----------------------
<body>
<form id="form1" runat="server">
<div>
请输入验证码(为英文/数字)
<asp:TextBox ID="txtYZM" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="btnShengCheng" runat="server" Xonclick="btnShengCheng_Click"
Text="生成" />
<br />
</div>
</form>
</body>
--------WebYanZhengMa.aspx.cs后台----------------------
protected void btnShengCheng_Click(object sender, EventArgs e)
{
System.IO.MemoryStream bstream = new System.IO.MemoryStream();
cn.com.webxml.www3.ValidateCodeWebService validate = new
cn.com.webxml.www3.ValidateCodeWebService();
byte[] Ary=validate.enValidateByte(txtYZM.Text);
HttpContext.Current.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.ContentType = "image/Png";
HttpContext.Current.Response.BinaryWrite(Ary);
HttpContext.Current.Response.End();
}
-----------Web.config------------------
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup,
System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="_2013_1_6.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<connectionStrings>
<add name="studentConstr" connectionString="data source=.;initial catalog=student;user
id=sa;password=111111"/>
</connectionStrings>
<applicationSettings>
<_2013_1_6.Properties.Settings>
<setting name="_2013_1_6_cn_com_webxml_www_WeatherWebService"
serializeAs="String">
<value>http://www.webxml.com.cn/WebServices/WeatherWebService.asmx</value>
</setting>
<setting name="_2013_1_6_cn_com_webxml_www1_TrainTimeWebService"
serializeAs="String">
<value>http://www.webxml.com.cn/WebServices/TrainTimeWebService.asmx</value>
</setting>
<setting name="_2013_1_6_cn_com_webxml_www2_TranslatorWebService"
serializeAs="String">
<value>http://www.webxml.com.cn/WebServices/TranslatorWebService.asmx</value>
</setting>
<setting name="_2013_1_6_cn_com_webxml_webservice_MobileCodeWS"
serializeAs="String">
<value>http://webservice.webxml.com.cn/WebServices/MobileCodeWs.asmx</value>
</setting>
<setting name="_2013_1_6_cn_com_webxml_www3_ValidateCodeWebService"
serializeAs="String">
<value>http://www.webxml.com.cn/WebServices/ValidateCodeWebService.asmx</value>
</setting>
</_2013_1_6.Properties.Settings>
</applicationSettings>
</configuration>