views:

74

answers:

1

Hi, from a Wcf data service client (inherited from System.Data.Services.Client.DataServiceContext) I would like to invoke a service operation defined on a Wcf Data Service that returns void

[WebGet]
public void Operation()
{
  // logic
}

The only reasonable method I found is the Execute, but how could I use it with a void operation?

Thank you

+1  A: 

You can use just plain HttpWebRequest to do this. I think it will need to be POST service operation (as GET would assume some response, but since you declare it as void it would have no response). In which case Execute can't be used anyway (as it always issues a GET request). Using plain HttpWebRequest just issue a simple POST to the service operation URL and just check the response status code (should be 204 No Content). Currently WCF Data Services doesn't have native client support for service operations, so you need to write one for yourself.

Vitek Karas MSFT