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 7767903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:47:17+00:00 2026-06-01T15:47:17+00:00

I think something buggy is up with my GET method as I am getting

  • 0

I think something buggy is up with my GET method as I am getting nothing returned when I try to run a piece of client code.

My GET operation contract looks like this:

    [OperationContract] 
    [WebInvoke(Method = "GET", 
    BodyStyle = WebMessageBodyStyle.Bare, 
    RequestFormat = WebMessageFormat.Xml, 
    ResponseFormat = WebMessageFormat.Xml, 
    UriTemplate = "/Group/{TagName}")]
    List<Group> GetGroupsCollection(string TagName);

    public List<Group> GetGroupsCollection(string TagNames)
    {
        List<Group> groups = (from g in Groups 
                where
                    (from t in g.Tags where t.TagName == TagNames select t).Count() > 0
                select g).ToList();
    return groups;
    }

Now I dont have any data to test this with so I have to manually add groups and tags from my client side, I then attempt to add a tag to a group and I do this like so:

    [OperationContract]
    [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml, UriTemplate = "/AddTagtoGroup/{group}/{tag}")]
    void AddTagtoGroup(string group, string tag);

    public void AddTagtoGroup(string group, string tag)
    {
        var result = Groups.Where(n => String.Equals(n.GroupName, tag)).FirstOrDefault();
        if (result != null)
        {
            result.Tags.Add(new Tag() { TagName = tag });
        }
    }  

And from client this is done like this:

    private void AddTagetoGroup_Click(object sender, EventArgs e)
    {
        string uriAddTagtoGroup = string.Format("http://localhost:8000/Service/AddTagtoGroup/{0}/{1}", textBox6.Text, textBox7.Text);
        byte[] arr = Encoding.UTF8.GetBytes(uriAddTagtoGroup);
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uriAddTagtoGroup);
        req.Method = "POST";
        req.ContentType = "application/xml";
        req.ContentLength = arr.Length;
        Stream reqStrm = req.GetRequestStream();
        reqStrm.Write(arr, 0, arr.Length);
        reqStrm.Close();
        HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
        MessageBox.Show(resp.StatusDescription);
        reqStrm.Close();
        resp.Close();
    }

The message I get back is OK and all seems fine.

Now the piece of client code I get a problem with is this:

    string uriGetGroupsCollection = "http://localhost:8000/Service/GetGroupsCollection/{TagName}";
    private void button8_Click(object sender, EventArgs e)
    {
        string tagUri = uriGetGroupsCollection.Replace("{TagName}", textBox8.Text);

        XDocument xDoc = XDocument.Load(tagUri); //this line gives 404 error not found.
        var Tag = xDoc.Descendants("Group")
            .Select(n => new
            {
                Tag = n.Element("GroupName").Value,
            })
            .ToList();
        dataGridView3.DataSource = Tag;
    }

Which is related to the GET operation I first mentioned. So I am unsure how to find out if its the client code doing something wrong or my actual GetGroupsCollection method?

So either my problem is related to adding a tag to a group:

    public void AddTagtoGroup(string group, string tag)
    {
        var result = Groups.Where(n => String.Equals(n.GroupName, tag)).FirstOrDefault();
        if (result != null)
        {
            result.Tags.Add(new Tag() { TagName = tag });
        }
    }  

Or its related to the client side code for GetGroupsCollection?

I updated my question to reflect the small error I was previously getting which surfen solved (404 error) but this hasnt solved my problem of not getting anything back?

  • 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-06-01T15:47:19+00:00Added an answer on June 1, 2026 at 3:47 pm

    I think that you’ve made a mistake in your URL:

    string uriGetGroupsCollection = "http://localhost:8000/Service/GetGroupsCollection/{TagName}";
    

    since you defined your URITemplate like this: "/Group/{TagName}"

    [OperationContract] 
    [WebInvoke(Method = "GET", 
    BodyStyle = WebMessageBodyStyle.Bare, 
    RequestFormat = WebMessageFormat.Xml, 
    ResponseFormat = WebMessageFormat.Xml, 
    UriTemplate = "/Group/{TagName}")]
    List<Group> GetGroupsCollection(string TagName);
    

    So your URL in the client should look like this:

    string uriGetGroupsCollection = "http://localhost:8000/Service/Group/{TagName}";
    

    OR change your URITemplate to:

    UriTemplate = "/GetGroupsCollection/{TagName}")]
    

    UPDATE

    Your AddTagtoGroup has another typo.

        var result = Groups.Where(n => String.Equals(n.GroupName, tag)).FirstOrDefault();
    

    should be:

        var result = Groups.Where(n => String.Equals(n.GroupName, group)).FirstOrDefault();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm think something like Facebook apps here. User generated pieces of code that people
I'm trying to get this simple PowerShell script working, but I think something is
I keep getting a exc bad access error and I think it has something
I think something happened to an mdf file on disk. When I try to
I think something is getting subtly mangeled when I attempt to execute a subprocess
I think something is wrong with my create method. When I create a new
I think I encountered something extraordinary strange in VS 2008. All the array values
I think I need something akin to a rails eager loaded query with a
I think there is something I don't understand about same origin limitation for XMLHttpRequest
Last night I think I did something that hosed my rails development environment, and

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.