我正在尝试使用.net 1.1创建一个接受对象作为参数的Web服务。当我创建类对象并使用创建的对象参数调用该Web方法时,我得到“方法没有重载'数量'需要'3'参数”错误。
//这是我的网络方法
[WebMethod]
public void Deposit(Amount amount)
{
string tranAmount;
string tranCurrency;
string exchangeAmt;
try
{
tranAmount = amount.amount;
tranCurrency = amount.currency;
exchangeAmt = amount.amt.amt;
}
catch(Exception ex)
{
Utility.LogMsg(ex.Message);
}
}
[Serializable]
public class Amount
{
private string _amount;
private string _currency;
private AmountTest _amtTest;
public Amount()
{
}
public Amount(string strAmount,string strCurrency, string strAmt)
{
amount = strAmount;
currency = strCurrency;
amt = new AmountTest(strAmt);
}
public string amount
{
get
{
return _amount;
}
set
{
_amount = value;
}
}
public string currency
{
get
{
return _currency;
}
set
{
_currency = value;
}
}
public AmountTest amt
{
get
{
return _amtTest;
}
set
{
_amtTest = value;
}
}
}
[Serializable]
public class AmountTest
{
private string _amt;
public string amt
{
get
{
return _amt;
}
set
{
_amt = value;
}
}
public AmountTest()
{
}
public AmountTest(string strAmt)
{
amt = strAmt;
}
}
//这是我的客户电话
webservice service = new webservice();
Amount amount = new Amount("10","USD","101"); // Error happen here
service.Deposit(amount);
请说明如何纠正它们。提前谢谢。