![](/img/trans.png)
[英]Not all parameters in WCF data contract make it through the web service call
[英]How to call a Web Service from another WCF to return a data contract containing and object as data member
/* SERVICE CONTRACT */
[ServiceContract]
public interface IEntity
{
[OperationContract]
CustomerDetail GetCustomer(string entityID);
//string GetCustomer(string entityID);
[OperationContract]
List<CustomerDetail> GetCustomerList(List<string> entityIDList);
}
/* DATA CONTRACT */
[DataContract]
public class CustomerDetail
{
[DataMember]
public Customer customerDetail; //Customer is defined in the webservice i'm calling
}
/* Actual service contract implementation */
public CustomerDetail GetCustomer(string ID)
{
ThirdParty tpws = new ThirdParty();
var c = tpws.GetCustomerByCustomerID(ID);
CustomerDetail cd = new CustomerDetail();
999 cd.customerDetail = c[0];
return cd;
}
当我在VS2010的断点位于上面的999行上运行此命令时,一切正常,但是返回无法在WCF Test Client中显示任何内容-返回和错误- 收到对...的HTTP响应时发生了错误。
这只是一个猜测,但请在调试器中停在“ 999”行之前,然后看一下c
。 我打赌c.Length == 0
。
您是否已验证“客户”类型是否可序列化(是否已用DataContractAttribute,SerializableAttribute或类似字符修饰)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.