tags:

views:

36

answers:

1

Hi, I have created a WCF service in my project and I have some classes on the server side that I use on the servers side and on the client side via reference.

using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace DataEntities {

[DataContract]
public class PlanEntriesData
{
    private ObservableCollection<entry> entries;

    public PlanEntriesData()
    {
        entries = new ObservableCollection<Entry>();
    } 

    [DataMember]
    public ObservableCollection<Entry> Entries
    {
        get { return entries; }
        set { entries = value; }
    }

    public string helloWorld()
    {
        return "hello";
    }
}

}

The problem is on the client side the object has no helloWorld() method. Can anyone help me with how to get the methods ?

best regards sushiBite

A: 

Methods are not sent, only properties. There is currently no way to supply the implementation details of a method across a WCF boundary on a DataContract.

If you want to be able to operate on an entity from the client in such a way, you will need to add the HelloWorld operation to your ServiceContract.

public IMyService
{
     string HelloWorld(PlanEntriesData data);
}

I'd recommend a little bit of reading up on service orientation and WCF in general. I've found "Windows Communication Step-by-Step" to be a good read for beginners.

Anderson Imes
I was hoping that I could solve this differently :P Thanks
sushiBite