我正在尝试使用 WCF 测试客户端来测试我构建的 WCF 服务。
该服务有一种方法“SubmitRequest”。
[OperationContract]
Response SubmitRequest(Request request);
当我加载 WCF 测试客户端时,该方法显示为灰色,并显示消息“WCF 测试客户端不支持此操作,因为它使用 WcfLibrary.Objects.Request 类型
下面是类型定义,有没有人看出什么问题?
[DataContract]
public class Request
{
[DataMember]
public string LoanNumber { get; set; }
[DataMember]
public string ClientCode { get; set; }
[DataMember]
public Region Region { get; set; }
[DataMember]
public RequestType RequestType { get; set; }
[DataMember]
public List<RequestParameter> RequestParameters { get; set; }
[DataMember]
public List<MspWebCallType> MspWebCallsForXmlRequest { get; set; }
[DataMember]
public Hashtable XmlRequestParameters { get; set; }
public Request(string loanNumber, string clientCode, Region region, RequestType requestType, List<RequestParameter> requestParameters)
{
LoanNumber = loanNumber;
ClientCode = clientCode;
Region = region;
RequestType = requestType;
RequestParameters = requestParameters;
}
}
[DataContract]
public class MspWebCallType
{
[DataMember]
public string WebService { get; set; }
[DataMember]
public string Operation { get; set; }
[DataMember]
public string Version { get; set; }
[DataMember]
public Hashtable Parameters { get; set; }
[DataMember]
public Msp.FavReadViews FAVReadViewIndicator { get; set; }
[DataMember]
public Msp.DsReadIndicators DSReadInidicator { get; set; }
}
[DataContract]
public enum Region
{
[EnumMember]
P2,
[EnumMember]
PROD
}
[DataContract]
public enum RequestType
{
[EnumMember]
None,
[EnumMember]
XmlRequest,
[EnumMember]
SomeOtherRequestType
}
[DataContract]
public struct RequestParameter
{
[DataMember]
public string ParameterName { get; set; }
[DataMember]
public string ParameterValue { get; set; }
}
谢谢。
编辑 w/ answer...
该操作无法通过 WCF 测试客户端使用,因为 MspWebCallType 类型具有 Hashtable 类型的属性。一旦我删除了这个属性,它就解决了这个问题。感谢大家的帮助。