先做事后做人

博客园 首页 新随笔 联系 订阅 管理

第一个webserver的源码.

using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://wzw1227.blogbus.com")]   //自定义名称空间
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
   
    public Service () {

        //Uncomment the following line if using designed components
        //InitializeComponent();
    }
    public struct ClientData
    {
        public string Name;
        public int ID;
    }
    [WebMethod(CacheDuration=20,      
        Description="my baby")]               //CacheDuration
cache时间,Description是描述
    public ClientData[] GetClientData(int Number)
    {
        ClientData[] clients = null;
        if (Number > 0 && Number <= 10)
        {
            clients = new ClientData[Number];
            for (int i = 0; i < Number; i++)
            {
                clients[i].Name = "client" + i.ToString();
                clients[i].ID = i;
            }           
        }
        return clients;
    }
    [WebMethod]                                               //
标记(说明是WEB的方法)
    public string helloword(string name)
    {
        string dname = "hello" + name;
        return name;
    }
   
}

 

 

posted on 2006-03-15 14:25  asdfasdf  阅读(283)  评论(0)    收藏  举报