Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4274738
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:53:18+00:00 2026-05-21T07:53:18+00:00

from a Wcf data service client (inherited from System.Data.Services.Client.DataServiceContext) I would like to invoke

  • 0

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 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:53:18+00:00Added an answer on May 21, 2026 at 7:53 am

    I have found a workaround for this problem.
    This website solved me quite a few problems before, so I thought it would be nice to share back.

    The quick answer to your question is:

     string empty = context.Execute<string>(new Uri("Operation", UriKind.Relative)).FirstOrDefault();
    

    The “empty” string should be null or empty upon response. It “works around” the HttpWebRequest method mentioned on the post above.

    Further more, it is also possible to get primitive types back using this technique.
    Lets say I have this Method:

    [WebGet]
    public bool Authenticate(string Username, string Password)
    {...do stuff here...}
    

    When you try the normal execution it fails (Vitek Karas explains it well in his reponse above):

        var query = context.CreateQuery<bool>("Authenticate").AddQueryOption("Username", "'itye'").AddQueryOption("Password","'123456'");
    DataServiceCollection<bool> list = new DataServiceCollection<bool>();
    list.Load(query);
    

    But the following will do the trick:

    var query = context.CreateQuery<bool>("Authenticate").AddQueryOption("Username", "'itye'").AddQueryOption("Password","'123456'");
    
    bool authenticated = context.Execute<bool>(new Uri(query.RequestUri.ToString().Replace("Authenticate()", "Authenticate"))).FirstOrDefault();
    

    Please note the Replace(“Authenticate()”, “Authenticate”), which omits () from the query string (otherwise it will cause error).

    Hope it helps.
    – Itye

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My WCF Service uses wsHttpBinding and works fine from the client when the service
I have a WCF service that I have to reference from a .net 2.0
I am returning a List from my WCF method. In my client code, it's
From a web service (WCF), I want an endpoint to take 10 seconds to
From what I've seen the tag is ignored when hosting a WCF service in
I have a WCF Web Service which is referenced from a class library. After
I would like to get a sum from a column, with and without a
I'm not certain where the error is resulting (from silverlight, from wcf, something else...)
Using .Net 3.0 and VS2005. The objects in question are consumed from a WCF
Is it possible to gather performance statistics programmatically from inside a WCF application? For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.