Tuesday, 17 September 2013

is not convertible by 'QueryStringConverter'

is not convertible by 'QueryStringConverter'

I'm still a little new to WCF, I have a service that takes as input an
object that contains a bunch of string properties, but when I try to
consume the service I get the following error:
Operation 'GetHouseholds' in contract 'IHouseholdService' has a query
variable named 'criteria' of type
'RGMPServices.Householding.Contracts.DataTransferObjcets.HouseholdSearch',
but type
'RGMPServices.Householding.Contracts.DataTransferObjcets.HouseholdSearch'
is not convertible by 'QueryStringConverter'. Variables for UriTemplate
query values must have types that can be converted by
'QueryStringConverter'.
how do I go about making an object 'QueryStringConvertable'??
I have contract which looks like this:
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json)]
HouseholdDto[] GetHouseholds(HouseholdSearch criteria);
And the implementation is this:
public HouseholdDto[] GetHouseholds(HouseholdSearch criteria)
{
IList<Household> households =
_kernel.Get<IHouseholdRepository>().Search(criteria);
IList<HouseholdDto> dtos = Mapper.Map<IList<Household>,
IList<HouseholdDto>>(households);
return dtos.ToArray();
}
And my data contract for the object to be passed in is this:
[DataContract(Namespace = "urn:RGMPServices.Householding.Services", Name =
"HouseholdSearch")]
public class HouseholdSearch : IHouseholdSearch
{
[DataMember(IsRequired = false, Name = "HouseholdNumber")]
public string HouseholdNumber { get; set; }
[DataMember(IsRequired = false, Name = "HouseholdName")]
public string HouseholdName { get; set; }
[DataMember(IsRequired = false, Name = "AccountNumber")]
public string AccountNumber { get; set; }
[DataMember(IsRequired = false, Name = "AccountName")]
public string AccountName { get; set; }
[DataMember(IsRequired = false, Name = "IaCodes")]
public string IaCodes { get; set; }
[DataMember(IsRequired = false, Name = "Category")]
public string Category { get; set; }
}

No comments:

Post a Comment