I am developing an wcf-webservice. The consumer is able to choose between an atom-response and a json-response.
My OperationContract looks like this:
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "json/json")]
Result GetData();
The Result-Type contains some strings and an array of entries.
[DataContract]
public class Result
{
[DataMember]
public string baseUrl;
[DataMember]
public string url;
[DataMember]
public string title;
[DataMember]
public int totalResults;
[DataMember]
public JsonEntries[] resources;
}
I marked the JsonEntries also as DataContract:
[DataContract]
public class JsonEntries
{
[DataMember]
public string updated;
[DataMember]
public string key;
[DataMember]
public string title;
[DataMember]
public Salary salarie;
}
However, when i am trying to run this i get the error, that the metadata could not be called. When I am deleting the [DataMember] in front of the array, i get no error, but my response doesnt contain the array.
I've seen it work like this on various exmaples. So what am i doing wrong?
thanks in advance.
robidd