Reputation:
Sorry, If It is a stupid question but I am new to WCF. I have a C# project in which, I am loading a XML document (contains name of students and Id) using Linq to xml and I have to get the associated data (their due date, amount and stuff ) from a WCF service (a link is given).
How do I get the associated data from WCF service ? Do I just right click and add service reference.
Upvotes: 1
Views: 3314
Reputation: 14919
You need to define WCF
methods with concrete types. You can not declare a method that returns anonymous objects, or interfaces.
Just create a DTO
object representing you XML
, and using Linq to Xml
populate these DTO
s. Then in your service methods, set the return types to these DTO
s.
After adding the service reference, create a client proxy; like,
ServiceReference1.ClientProxy proxy = new ServiceReference1.ClientProxy();
var data = proxy.SomeMethod(someArguments);
Upvotes: 2