定义了一个实体类,里面有一个方法
        public string ERRINFO
        {
            get { return _errInfo; }
            set { _errInfo = value; }
        }
        public  void AddYw_cj_bgjzbList(YW_CJ_BGJZB_ZZTB o)
        {
            Yw_cj_bgjzbList.Add(o);
        }
通过webservice 在客户端怎么点不出来?
里面的属性可以
YWsModel ywsmodel = new YWsModel();
   ywsmodel.ERRINFO但 ywsmodel.AddYw_cj_bgjzbList 不行,请教是怎么回事

解决方案 »

  1.   

    [WebMethod]
    public void AddYw_cj_bgjzbList(YW_CJ_BGJZB_ZZTB o)
      

  2.   

    to bdmh
    好像还是不行,,,
      

  3.   

    to bdmh
    多谢指点,但好像还是不行,,,,
      

  4.   

    实体类为什么会有方法?方法难道不应该在接口中定义?VS新建的WebService示例。
    using System;
    using System.Globalization;
    using System.Web.Services;
    using System.Web.Services.Protocols;namespace WJSService
    {
        /// <summary>
        /// 
        /// </summary>
        [WebService(Namespace = "http://www.heibing.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]    public class SysMail : BaseService
        {        /// <summary>
            /// 测试
            /// </summary>
            /// <returns></returns>
            [WebMethod(Description = "测试程序")]
            public string HelloWorld()
            {
                return "Hello World";
            }
        }
    }声明一个自定义的实体    /// <summary>
        /// 文稿实体类
        /// </summary>
        public class Doc
        {
            public string ID { get; set; }
            public string TypeID { get; set; }
            public string SignOutUser { get; set; }
            public string Title { get; set; }
            public string Content { get; set; }    }创建一个文档生成服务using System;
    using System.Web.Services;
    using System.Web.Services.Protocols;
    using Aspose.Words;namespace WordService
    {
        /// <summary>
        /// WordCreate 的摘要说明
        /// </summary>
        [WebService(Namespace = "http://www.heibing.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
        [System.ComponentModel.ToolboxItem(false)]
        public class WordCreate : BaseService
        {
            /// <summary>
            /// 生成指定模板的WORD文件
            /// </summary>
            /// <param name="entity">传入的实体对象</param>
            /// <param name="templateName">模板文件名</param>
            /// <param name="isNeedRedHead">是否需要红头</param>
            /// <returns></returns>
            [WebMethod(Description = "生成指定模板的WORD文件")]
            public bool Convert(Doc entity,string templateName,bool isNeedRedHead)
            {
                return blnTemp;
            }
        }
    }客户端调用
    1、在VS中添加服务引用,命名为WordRef
    2、using System;
    using System.Globalization;
    using DocManager.WordRef;
    namespace DocManager.Docs
    {
        public partial class DownloadDocument : BasePage
        {
            public static bool CreateWord()
            {
                var entity = new Data.Docs();
                try
                {
                    //转换为WEB服务的实体对象
                    var ent = new WordRef.Doc
                    {
                        ID = entity.ID.ToString(CultureInfo.InvariantCulture),
                        Title = entity.Title,
                        Content = TrimCrlf(entity.Data),
                    }
                    var client = new WordCreateSoapClient();
                    //调用WEB服务的方法
                    var blnTemp = client.Convert(entity, "模板A.doc", false);
                    return blnTemp;
                }
                catch (Exception)
                {
                    return false;
                }
            }    }
    }