Use various Web services in

Source: Internet
Author: User

<Body> <form id = "form1" runat = "server"> <div> <asp: dropDownList ID = "DropDownList1" runat = "server" AutoPostBack = "True" Xonselectedindexchanged = "DropDownList1_SelectedIndexChanged"> </asp: DropDownList> & nbsp; <asp: dropDownList ID = "DropDownList2" runat = "server"> </asp: DropDownList> & nbsp; <asp: button ID = "btnChaKan" runat = "server" Xonclick = "btnChaKan_Click" Text = ""/> & nbsp; <asp: Label ID = "La Bel1 "runat =" server "Text =" Label "> </asp: Label> </div> </form> </body> --------- WebTianQi. aspx-Background ------------ 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 + = "temperature:" + strs [5] + "; wind direction and wind power:" + strs [7];} = ============ ------------ WebLieCheShiKeBiao. aspx front-end ------ <body> <form id = "form1" runat = "server"> <div> <br/> departure station: <asp: textBox ID = "txtFaCheZhan" runat = "server"> </asp: TextBox> <br/> arrival site: <asp: textBox ID = "txtDaoDaZhan" runat = "server"> </asp: TextBox> <br/> UserId: <asp: textBox ID = "txtUserId" runat = "server"> </asp: TextBox> <span> commercial user ID (not required by common users) </span> <br/> <asp: button ID = "btnChaXun" runat = "server" Xonclick = "btnChaXun_Click" Text = ""/> <br/> <asp: gridView ID = "GridView1" runat = "server"> </asp: GridView> </div> </form> </body> --------- WebLieCheShiKeBiao. aspx. cs background ----------------- 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 ();} ===========================================• phone number query ================ =====================-------- webdian=haoma. aspx front-end ---------- <body> <form id = "form1" runat = "server"> <div> enter the mobile phone number: <asp: textBox ID = "txtHaoMa" runat = "server"> </asp: TextBox> <br/> userID: <asp: textBox ID = "txtUserId" runat = "server"> </asp: TextBox> <span> do not enter the commercial user 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> -------- webdian=haoma. aspx. cs backend ------- 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 front-end ---------------------- <body> <form id = "form1" runat = "server"> <div> enter English or Chinese: <asp: textBox ID = "txtWord" runat = "server"> </asp: TextBox> <asp: button ID = "btnFanYi" runat = "server" Text = "Translation" Xonclick = "btnFanYi_Click"/> <br/> <asp: label ID = "Label1" runat = "server" Text = ""> </asp: Label> </div> </form> </body> ------ WebZhongYingWenFanYi. aspx. cs background ------------------------ 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];} ==========================================• Verification Code image ================== ===================-------- WebYanZhengMa. aspx front-end -------------------- <body> <form id = "form1" runat = "server"> <div> enter the verification code (in English or a number) <asp: textBox ID = "txtYZM" runat = "server"> </asp: TextBox> <br/> <asp: button ID = "btnShengCheng" runat = "server" Xonclick = "btnShengCheng_Click" Text = "generate"/> <br/> </div> </form> </body> -------- webYanZhengMa. aspx. cs background ---------------------- 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 =" _ blank "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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.