I'm still quite new the WCF Services
School assignments that I done on WCF were writing simple methods of WCF service which accepts strings or int or bool values.
However, I came across this wcf service that wasn't done by myself, and now I am required to write C# client to consume this service.
This WCF has a GetFees method which takes a Student Object as parameter (from WCF's Student DataContract)

My assignment is to Get Fees of particular students. The information i'm given are
StudentID=1, FirstName=Fernando, LastName=Gadd, Grade=4
StudentID=3, FirstName=Allan, LastName=Pascoe, Grade=1
Currently stuck on how to approach this question, but i'm thinking something like
Fee[] newFee1 = client.GetFees(new Student("1", "Fernando", "Gadd", "4".......
Fee[] newFee2 = client.GetFees(new Student("3", "Allan", "Pascoe", "1".......
Thank you whoever can help
Vishal GilbilePosted Mar 12, 2013, 12:29 AM
The error is clearing stating you that your GetFees function accepts a Student Array and not a single object in Such case what you can do is
Declare an Student array
Student[] objStudents=new Student[3];
objStudents[0]=new Student()
{
// Specify the following student details;
};
objStudents[1]=new Student();
{
// Specify the following student details;
}
objStudents[2]=new Student();
{
// Specify the following student details;
}
And Now call your GetFees function;
Fees []fees=client.GetFees(objStudents);
Hope that solves your problem. If it helps your kindly mark the answer as accepted.
With Regards,
Vishal Gilbile.
David ChenPosted Mar 12, 2013, 3:25 PM
I was thinking something like
for array of object mapping image
http://i.stack.imgur.com/CAvxs.jpg
David ChenPosted Mar 11, 2013, 11:09 PM
Vishal GilbilePosted Mar 11, 2013, 10:57 PM
What ever your query is its quite simple, what you performed is absolutely fine. Well I prefer the following way of doing the same because it looks quite clear.
Assuming that Student 1 Data Needs to be passed.
Student objStudent=new Student()
{
StudentId=1,
FirstName="Fernando",
LastName="Gadd",
Grade=4
};
Fee[] objFees=client.GetFees(objStudent);
Hope that works fine.
With Regards,
Vishal Gilbile.