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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:11:34+00:00 2026-06-09T07:11:34+00:00

I am making a REST call, the server side response is in the form

  • 0

I am making a REST call, the server side response is in the form of an XML. I am making this call asynchronously. I’ve test it as a Console application and it works as it should. However, when I test it on the XBOX , the asynchronous request is never completed. My processVideo method parses the XML and places the items into a List. I needed to reference this List from another class so I added (result.IsCompleted == false) to ensure that asynchronous call is completed before I reference and utilize the List. It seems that the asynchronous request is never completed and locks UI, any ideas?

 public void initilaizeRest()
    {
        WebRequest request = HttpWebRequest.Create(URI);
        request.Method = GET;
        // RequestState is a custom class to pass info to the callback
        RequestState state = new RequestState(request, URI);
        IAsyncResult result = request.BeginGetResponse(new AsyncCallback(getVideoList), state);

        Logger.Log("Querystate :"+QUERYSTATE+" URI:"+URI);

        /// Wait for aynchronous response to be completed
        while (result.IsCompleted == false)
        {
            Logger.Log("Sleeping");
            Thread.Sleep(100);
        }

    }

  public void getVideoList(IAsyncResult result)
    {
        RequestState state = (RequestState)result.AsyncState;
        WebRequest request = (WebRequest)state.Request;
        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);


        //Process response
        switch (QUERYSTATE)
        {
            case (int)Querystate.SERIESQUERY:
                Logger.Log("Processing series state");
                processSeries(response);
                break;
            case (int)Querystate.VIDEOQUERY:
                Logger.Log("Processing video state");
                processVideo(response);
                break;
        }

    }

public void processVideo(HttpWebResponse response)
{
      //parses XML into an object  and places items in a LIST
}
  • 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-09T07:11:35+00:00Added an answer on June 9, 2026 at 7:11 am

    The while loop is your problem. You shouldn’t wait like this for the async call to complete. You should do whatever you are wanting to do in the async callback that you send to the Begin method. The reason is that UI sets up a synchronization context which is used for async callbacks. The way this works is that the callbacks are marshalled onto the UI thread so that the UI context is maintained. Because your while loop is blocking your UI thread, the callback never occurs resulting in async call not completing.

    Hope this helps.

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

Sidebar

Related Questions

I am making a REST call that returns XML from within a Widget in
I'm making an ajax call to a rest API and specified the following header
After making the rest call through RKObjectManager,it is not loading the objects when i
I am making a GET request to a REST API using PHP to call
I am making a call to a REST API and I get back a
I tried reading the REST api for call making over and over again but
Making a call to a REST WebService in a Service class of my Android
I'm making a bunch of Rally API calls using the C# Rally Rest API
Let's say I want to build a REST service for making notes that looks
I am using RestSharp to consume a REST web service and will be making

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.