如何在 WCF 测试客户端 (WcfTestClient.exe) 中指定列表参数?
我正在使用 WCF 测试客户端 (WcfTestClient.exe) 来测试我的一项 wcf 服务.我有一个消息合同,其中包含一个 DataContracts 列表:我的消息合约如下:
I am using WCF Test Client (WcfTestClient.exe) for testing one of my wcf services. I have a message contract which has a list of DataContracts as : My message contract is as follows :
[MessageContract]
public class UpdateInvoiceStatusesRequest
{
private List<InvoiceStatusHistory> _invoiceStatusHistory;
[MessageBodyMember(Order = 0)]
public List<InvoiceStatusHistory> InvoiceStatusHistory
{
get { return _invoiceStatusHistory; }
set { _invoiceStatusHistory = value; }
}
}
我的数据合同是:
[DataContract]
public class InvoiceStatusHistory
{
private int _invoiceId;
private int _status;
private string _comment;
private string _timeStamp;
[DataMember]
public int InvoiceId
{
get { return _invoiceId; }
set { _invoiceId = value; }
}
[DataMember]
public string Comment
{
get { return _comment; }
set { _comment= value; }
}
[DataMember]
public int Status
{
get { return _status; }
set { _status = value; }
}
[DataMember]
public string TimeStamp
{
get { return _timeStamp; }
set { _timeStamp = value; }
}
}
当我使用 WcfTestClient.exe 测试带有 UpdateInvoiceStatusesRequest
消息契约的服务时,它显示 InvoiceStatusHistory
的值为 length = 0,现在我不知道如何我可以在 List
中添加 InvoiceStatusHistory
的对象吗?有没有人对此有任何想法,请帮助我?
when i am using WcfTestClient.exe to test the service with UpdateInvoiceStatusesRequest
message contract it shows the value of InvoiceStatusHistory
as length = 0, now i don't know how can i add the objects of InvoiceStatusHistory
in List<InvoiceStatusHistory>
?
Does anyone has any idea about it, please help me?
在框中键入 length=1
.+
符号将出现在请求参数名称旁边.单击它,然后单击 [0]
节点,该节点指示数组中的第一个元素并照常设置其值.
Type length=1
in the box. A +
sign will appear next to the request parameter name. Click on it, then on the [0]
node which indicates the first element in the array and set its values as usual.