调用WebService方法
?通过脚本调用: 通过添加web引用调用: 调用本地解决方案中的WebService 添加新项->Web服务(WebService.asmx) 在WebService.cs中添加方法(简单加法)Add(int a,int b) 代码: [WebMethod] 保存 在WebPage(Default.aspx)中调用 先添加web引用->此解决方案中的Web服务->添加WebService.asmx引用(引用名;testWebService) 在Default.aspx中的添加TextBox1,TextBox2,label1,button1 在button1的触发事件中添加调用代码: testWebService.WebService test=new testWebService(); int a=Convert.ToInt32(TextBox1.text); int b=Convert.ToInt32(TextBox2.text); int c; c=test.Add(a,b); label1.text=c.toString(); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |