views:

321

answers:

1

I'm calling off asynchronously to a web service (Amazon Web Services) from a Silverlight app and my callback method is never actually triggered after I start the asynchronous call.

I've set up another web service proxy in a console app, and I'm able to make a synchronous call and get a response using the same arguments without any issues.

Am I possibly having problems with the fact that this is called from within a browser? I'm not sure where to start, since I don't get a response at all, much less an error.

Below is the code I'm using:

    private void btnQueryAmazon_Click(object sender, RoutedEventArgs e)
    {
        if (!string.IsNullOrEmpty(txtQuery.Text))
        {
            ItemSearch search = new ItemSearch();
            /// set authentication and search parameters
            AmazonService.AWSECommerceServicePortTypeClient service = new AmazonService.AWSECommerceServicePortTypeClient();

            service.ItemLookupCompleted += new EventHandler<AmazonService.ItemLookupCompletedEventArgs>(service_ItemLookupCompleted);
            service.ItemSearchAsync(search);
        }
    }

    void service_ItemLookupCompleted(object sender, AmazonService.ItemLookupCompletedEventArgs e)
    {
            txtError.Text = e.Result.Items.Count().ToString();
            grdItems.ItemsSource = e.Result.Items;
    }
+1  A: 

Well, there's your problem ;)

It looks like you're calling the ItemSearch method on the service, but you're wiring up and handling the ItemLookup method.

I do it all the time.

Erik Mork
Wow. More sleep is in order. Thanks for the discerning eyes!
Sometimes you trick Silverlight.Sometimes Silverlight tricks you. take care!
Erik Mork