2 liuxiaochen123 liuxiaochen123 于 2013.06.06 11:55 提问

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

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

1个回答

hxn_217
hxn_217   2013.06.06 15: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; }
    }
}
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!