Rasmus

Rasmus

  • NA
  • 1
  • 0

How do I access entity-classes in my webservice from the client(consumer)?

Jun 21 2008 6:15 PM

Hey everybody,

I'm playing around with webservices in C#.

I have made a new project, a ASP.NET Web Service Application.

The project is  just a test project, where I have built to classes. A Person class, and a PersonList class which just performs as a object which can hold person-objects.

In my Service.asmx class i have created a PersonList object and two Person objects which i have added to the PersonList.

I have made a WebMethod so clients to the service can get the PersonList.

[WebMethod]
public PersonList GetPersonList()
{
      return personList;
}

 
I call the webmethod from the client (Console Application) and recieve my PersonList object and I can use the methods ec. I guess the client knows the PersonList class because it is declared as the return type in the webmetod! I'm not sure.

Here comes my problem:

When I want to take a Person object out of my PersonList, the client application dosn't know the Person class and therefore I can't use the Person objects methods or get data out of its attributes ect.

How can I tell the client about the Person class so I can use it?
Do I have to annotate the Person class with something?

Hope you can help me.

Best regards,

Rasmus