Here are my data contracts:
[DataContract]
public class Claim : IDisposable
{
[DataMember]
public int ClaimID { get; set; }
[DataMember]
public Stream ClaimImage { get; set; }
[DataMember]
public int PageNumber { get; set; }
public void Dispose()
{
if (ClaimImage != null)
{
ClaimImage.Close();
ClaimImage = null;
}
}
}
[DataContract]
public class ClaimInformation
{
[DataMember]
public List<string> Documents { get; set; }
[DataMember]
public int TotalPages { get; set; }
}
I have an OperationContract that takes a "ClaimInformation" and returns a list of "Claim." Which is just two integers and an image that is broken down into a stream.
[OperationContract]
List<Claim> ProcessDocument(ClaimInformation ClaimInfo);
ProcessDocument calls a method in a class.
public List<Claim> ProcessDocument(ClaimInformation ClaimInfo)
{
List<Claim> FinishedClaimList = new List<Claim>();
Document doc = new Document();
FinishedClaimList = doc.ProcessDocument(ClaimInfo);
return FinishedClaimList;
}
That method is too large for me to post here. But it's just this:
public List<Claim> ProcessDocument(ClaimInformation ClaimInfo)
{
Inside of the method, it creates a new "Claim" and adds it to the "ClaimList."
ClaimList.Add(new Claim { ClaimID = ClaimID, ClaimImage = this.GetStream(newdoc.FullName), PageNumber = pageNum });
And finally, this is how I'm calling it all:
OCREngine.IEngine engine = new OCREngine.EngineClient();
OCREngine.ClaimInformation CI = new ClaimInformation();
CI.Documents = ImageNames;
CI.TotalPages = cc.lbClaims.Items.Count;
ClaimList.Add(engine.ProcessDocument(CI));
I'm just creating a new client for the service and then instantiating a new ClaimInformation DataContract. I set the ImageNames property, which is just a list of strings and then I add an integer to the TotalPages.
Any ideas on what I'm doing wrong here?