I have developed some basic web services using WCF. So far the return types have been fairly simple. Here are the Operation contracts that are working correctly:
[OperationContract]
string Vessel(int ID);
//lists all vessel
[OperationContract]
List<string> Vessels();
[OperationContract]
List<string> PortsLike(string LikeStr);
[OperationContract]
Port GetPort(string name);
These have worked beautifully. I have now tried to push the envelope a bit and tried the following:
[OperationContract]
List<Pair> Vessels(List<string> fields, List<Criterion> criteria);
Where Pair and Criterion are pretty basic classes that I defined.
unfortunately this latest Operation does not compile. Is this because I have reached the limits of what can be accommodated by web services or am I doing something obviously wrong?
Here are the definitions for Pair and Criterion:
[DataContract]
public class Criterion
{
[DataMember]
public string Key { get; set; }
[DataMember]
public string Operator { get; set; }
[DataMember]
public string Value { get; set; }
}
[DataContract]
public class Pair
{
[DataMember]
public string Key { get; set; }
[DataMember]
public string Value { get; set; }
public Pair(string key, string value)
{
this.Key = key;
this.Value = Value;
}
}
Here is the error I get from the compiler:
Error 1 'VOps.VOpsService' does not implement interface member 'VOps.IVOpsService.Vessels(System.Collections.Generic.List, System.Collections.Generic.List)'. 'VOps.VOpsService.Vessels(System.Collections.Generic.List, System.Collections.Generic.List)' cannot implement an interface member because it is not public.