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

  • SEARCH
  • Home
  • 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 6593453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:41:02+00:00 2026-05-25T17:41:02+00:00

I am creating a Restful service in VS 2010. I have a class Advisor.

  • 0

I am creating a Restful service in VS 2010. I have a class Advisor. The SubmitAdvisor method takes this class as a parameter, and the ListAdvisors returns the List of Advisor.

I wrote a console client to Get and Post these methods. I included Microsoft.Http in my client.

I am not able to see the list of Advisors even after Posting the data using HttpClient.

Inside Service Interface –

[WebInvoke(Method="POST",UriTemplate="/")]
[OperationContract]
void SubmitAdvisor(Advisor advisor);

[WebGet(UriTemplate = "/")]
[OperationContract]
List<Advisor> ListAdvisors();

Inside Service Implementation –

List<Advisor> advisors = new List<Advisor>();
public void SubmitAdvisor(Advisor advisor)
{           
   advisors.Add(advisor);
}

public List<Advisor> ListAdvisors()
{
   return advisors;
}

In my client app –

public static void  InsertData(Advisor obj)
        {         
            using (HttpResponseMessage  response = new HttpClient().Post(uri,HttpContentExtensions.CreateDataContract(obj)))
            {    
            }; 
        }

         public static List<Advisor> GetAllAdvisors()
         {
             using (HttpResponseMessage response = new HttpClient().Get(uri)) 
             {
                 return response.Content.ReadAsDataContract<List<Advisor>>();               
             };
         }
  • 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-25T17:41:03+00:00Added an answer on May 25, 2026 at 5:41 pm

    I was able to retrieve the list by making the Service as singleton, or setting the InstanceContextMode to Single.

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

Sidebar

Related Questions

I just noticed while creating a RESTful WCF service that the Method parameter on
I've been working off an example (http://bdoughan.blogspot.com/2010/08/creating-restful-web-service-part-45.html) and I've been debugging some issues and
Greetings: I have put together a RESTful web service in .NET 3.5 that takes
Here I am not creating a RESTful service indeed I have to call an
I have finally started messing around with creating some apps that work with RESTful
I am creating a web-based RESTful service and want to cloud-enable it for scalability.
I have just started reading on implementing RESTful web services and creating RESTful apis.
I have been trying to wrap my head around creating a RESTFul API using
I am considering creating a RESTful web service which will return a lot of
I have a RESTful WCF web service called "Palladium" as a project in my

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.