This is the Struct class I create
public struct Biller
{
public string BillerTag { get; set; }
public string Description { get; set; }
public string FirstField { get; set; }
public string FirstFieldFormat { get; set; }
public string FirstFieldWidth { get; set; }
public string SecondField { get; set; }
public string SecondFieldFormat { get; set; }
public string SecondFieldWidth { get; set; }
public string ServiceCharge { get; set; }
}
I am trying to use this code but it only shows 1 and only the last output
[WebMethod(Description = "Retrieves list of available BILLERS for collection as well as other information necessary for the transaction")]
public Biller GetBillerList(string AccountID, string UserName, string Password)
{
ECPNBills.ECPNBillsPaymentService Client = new ECPNBills.ECPNBillsPaymentService();
ECPNBills.BStruct Str = new ECPNBills.BStruct();
Biller Bil = new Biller();
Str = Client.GetBillerList(AccountID, UserName, Password);
foreach (ECPNBills.BStruct cd in Client.GetBillerList(AccountID, UserName, Password))
{
Bil.BillerTag = cd.BillerTag;
Bil.Description = cd.Description;
Bil.FirstField = cd.FirstField;
Bil.FirstFieldFormat = cd.FirstFieldFormat;
Bil.FirstFieldWidth = cd.FirstFieldWidth;
Bil.SecondField = cd.SecondField;
Bil.SecondFieldFormat = cd.SecondFieldFormat;
Bil.SecondFieldWidth = cd.SecondFieldWidth;
Bil.ServiceCharge = cd.ServiceCharge;
}
return Bil;
}
I am not sure what code to use in order to get all the items from BStruct.
I am also trying to consume webservice to webservice. Thank you in advance~
Change return type
of your method to List<Biller>
.
[WebMethod(Description = "Retrieves list of available BILLERS for collection as well as other information necessary for the transaction")]
public List<Biller> GetBillerList(string AccountID, string UserName, string Password)
{
ECPNBills.ECPNBillsPaymentService Client = new ECPNBills.ECPNBillsPaymentService();
ECPNBills.BStruct Str = new ECPNBills.BStruct();
List<Biller> BilList = new List<Biller>();
Str = Client.GetBillerList(AccountID, UserName, Password);
foreach (ECPNBills.BStruct cd in Client.GetBillerList(AccountID, UserName, Password))
{
Biller Bil = new Biller();
Bil.BillerTag = cd.BillerTag;
Bil.Description = cd.Description;
Bil.FirstField = cd.FirstField;
Bil.FirstFieldFormat = cd.FirstFieldFormat;
Bil.FirstFieldWidth = cd.FirstFieldWidth;
Bil.SecondField = cd.SecondField;
Bil.SecondFieldFormat = cd.SecondFieldFormat;
Bil.SecondFieldWidth = cd.SecondFieldWidth;
Bil.ServiceCharge = cd.ServiceCharge;
BilList.Add(Bil);
}
return BilList;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.