.net webservice 返回自定义对象(二)
时间:2011-05-21 来源:拎Q
⊙﹏⊙b汗,居然有字数限制。。。继续~~
ChangePwdService.asmx.cs
代码在这里~~(*^__^*) 嘻嘻……1 using System;
2 using System.Data;
3 using System.Web;
4 using System.Collections;
5 using System.Web.Services;
6 using System.Web.Services.Protocols;
7 using System.ComponentModel;
8 using MySql.Data.MySqlClient;
9 using System.Configuration;
10
11 namespace ChangePwd
12 {
13 /// <summary>
14 /// ChangePwdService 的摘要说明
15 /// </summary>
16 [WebService(Namespace = "http://taling.hnie.edu.cn/")]
17 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
18 [ToolboxItem(false)]
19 public class ChangePwdService : System.Web.Services.WebService
20 {
21 public MySoapHeader mySoapHeader;
22 [SoapHeader("mySoapHeader")]
23 [WebMethod(Description = "返回用户的个人信息")]
24 public UserCollection GetUser(string key, string value)
25 {
26 if (mySoapHeader.IsValid())
27 {
28 UserCollection userCollection = new UserCollection();
29 取数据~~略,填充userCollection
30 return userCollection;
31
32 }
33 else
34 {
35 return null;
36 }
37
38 }
39 [SoapHeader("mySoapHeader")]
40 [WebMethod(Description = "更改用户密码")]
41 public string UpdateUser(string uid, string password)
42 {
43 if (mySoapHeader.IsValid())
44 {
45 略~~~
46 return message;
47 }
48 else
49 {
50 return "无效的用户名密码!";
51 }
52 }
53 [SoapHeader("mySoapHeader")]
54 [WebMethod(Description = "验证身份")]
55 public bool Login()
56 {
57 return mySoapHeader.IsValid();
58 }
59 }
60 }
相关阅读 更多 +