summerlikewoods

 

.NETcall java web service using soapheader validate

1、首先,根据java 的web service 的soapheader定义所需要的元素来定义一个soap头类:
在这个java 的web service中,需要三个元素:from,to,platcode,具体代码如下:

  public partial class BLSoapHeader : System.Web.Services.Protocols.SoapHeader
    {
        /// <summary>
        /// 获得提单校验的BLSoapHeader
        /// </summary>
        /// <returns>提单校验soapheader对象</returns>
        public static BLSoapHeader GenerateBLSoapHeader()
        {
            BLSoapHeader header = new BLSoapHeader();
            header.platcode = "A";
            header.from = "B";
            header.to = "C";
            return header;
        }

        private string _from;
        public string from
        {
            get
            {
                return this._from;
            }
            set
            {
                this._from = value;
            }
        }

        private string _to;
        public string to
        {
            get
            {
                return this._to;
            }
            set
            {
                this._to = value;
            }
        }

        private string _platcode;
        public string platcode
        {
            get
            {
                return this._platcode;
            }
            set
            {
                this._platcode = value;
            }
        }
    }
2、修改reference.cs文件:
增加私有对象:
private BLSoapHeader soapHeaderValue;
增加属性:
        /// <summary>
        /// 手工添加,此属性为支持此ws的soapheader验证而添加
        /// </summary>
        public BLSoapHeader SoapHeaderValue
        {
            get{
                return this.soapHeaderValue;
            }
            set{
                this.soapHeaderValue = value;
            }
        }
在web方法上面添加特性:
[System.Web.Services.Protocols.SoapHeaderAttribute("SoapHeaderValue")]//手工添加
public string billStorageConfrimService(EbsBillBatchModel ebsBillBatchModel) {

}


posted on 2009-08-25 17:57  summerlikewoods  阅读(276)  评论(0编辑  收藏  举报

导航