liuxiaochen123
刘小小尘
采纳率0%
2013-06-06 03:55 阅读 4.9k

java用CXF实现webservice如何自定义soapheader?

java用CXF实现webservice如何自定义soapheader?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • hxn_217 hxn_217 2013-06-06 07:05

    自定义SoapHeader类,继承自:System.Web.Services.Protocols.SoapHeader

    using System;
    using System.Collections.Generic;
    using System.Web;
    
    /// <summary>
    ///自定义的SoapHeader
    /// </summary>
    public class MySoapHeader : System.Web.Services.Protocols.SoapHeader
    {
    
        private string userName=string.Empty;
        private string passWord=string.Empty;
    
        /// <summary>
        /// 构造函数
        /// </summary>
        public MySoapHeader() { } /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <param name="passWord">密码</param>
        public MySoapHeader(string userName, string passWord)
        {
            this.userName = userName;
            this.passWord = passWord;
        }
    
        /// <summary>
        /// 获取或设置用户用户名
        /// </summary>
        public string UserName
        {
            get { return userName; }
            set { userName = value; }
    
        }
    
        /// <summary>
        /// 获取或设置用户密码
        /// </summary>
        public string PassWord
        {
            get { return passWord; }
            set { passWord = value; }
        }
    }
    
    点赞 评论 复制链接分享

相关推荐