在这个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) {
}