sbj0707

Web service Remoting ADO.NET Windows server 2003

导航

复杂对象的WebService调用


这样的复杂对象的WebService调用为什么出错,怎么改
[WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public TableInfo Table()
        {
            ColumnInfo[] columns = new ColumnInfo[2];
            columns[0].Caption = "c1";
            columns[0].Name = "n1";
            columns[1].Caption = "c2";
            columns[1].Name = "n2";
            TableInfo table = new TableInfo();
            table.Columns = columns;
            return table;
       
        }
        [WebMethod]
        public int Add()
        {
            return 0;
        }
    }
    [Serializable]
    public class ColumnInfo
    {
        private string _name;


        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }
        private string _caption;


        public string Caption
        {
            get { return _caption; }
            set { _caption = value; }
        }
    }
    [Serializable]
    public class TableInfo
    {
        private ColumnInfo[] _columns;

        [XmlArrayItem("ColumnInfo", typeof(ColumnInfo))]
        public ColumnInfo[] Columns
        {
            get { return _columns; }
            set { _columns = value; }
        }
    }
 

posted on 2007-03-20 16:22  IT  阅读(1058)  评论(4)    收藏  举报