Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Failed to Invoke:CallOpen error calling WebService from Silverligh

Reply
Thread Tools

Failed to Invoke:CallOpen error calling WebService from Silverligh

 
 
Bob
Guest
Posts: n/a
 
      07-13-2009
I have built an ASP.NET Web Service from an existing database in SQL Server
2008 using the Entity Framework model. This works fine and the service can be
viewed as expected from Internet Explorer. One of the tables in the db is a
Customers collection. I have placed ClientAccessPolicy and CrossDomainPolicy
files in the root of the site. The site is running at
http://localhost:1111/LiveTrackerService.svc.

I now build a Silverlight app in a separate solution and can add a service
reference to the service OK.

I try to access the Customers table with the code shown below. This fails
with the error "Failed to Invoke:callOpen" at the line atcq.BeginExecute.

In the commented out section of the code I try to call the service via the
DownloadStringAsync method. This fails with
System.Reflection.TargetInvocationError.

It doesn't seem to be a cross domain issue. Web Development Helper shows the
CAP file being found OK.

Any help will be greatly appreciated.


void Page_Loaded(object sender, RoutedEventArgs e)
{
LiveTrackerData.TrackingEntities proxy =
new LiveTracker.LiveTrackerData.TrackingEntities(new
Uri("http://localhost:1111/LiveTrackerData.svc", UriKind.Absolute));

var customers = from c in proxy.Customer
select c;
var atcq =
(DataServiceQuery<Customer>)customers;
atcq.BeginExecute(new AsyncCallback(OnLoadComplete), atcq);
//WebClient restClient = new WebClient();
//restClient.DownloadStringCompleted += new
DownloadStringCompletedEventHandler(restClient_Dow nloadStringCompleted);
//restClient.DownloadStringAsync(new
Uri("http://localhost:1111/LiveTrackerData.svc/Customer",
UriKind.RelativeOrAbsolute));
}

void restClient_DownloadStringCompleted(object sender,
DownloadStringCompletedEventArgs e)
{
string test = e.Result;
}

void OnLoadComplete(IAsyncResult result)
{
DataServiceQuery<Customer> trackerQuery =
(DataServiceQuery<Customer>)result.AsyncState;
try
{
List<Customer> trackers =
trackerQuery.EndExecute(result).ToList();
foreach (Customer atc in trackers)
{
ListBoxItem item = new ListBoxItem();
item.Content = atc.CustomerName;
TrackerList.Items.Add(item);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
;

}


--
Bob
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem! webservice.htc calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 1 01-26-2006 12:05 PM
Problem! webservice.htc calling nonsecure webservice from a secured ssl https webpage batista ASP .Net Web Services 0 01-26-2006 08:14 AM
Problem! webservice.htc calling nonsecure webservice from a secured ssl https webpage batista ASP .Net 0 01-26-2006 08:13 AM
Calling a webservice from a webservice bgauvey@gmail.com ASP .Net Web Services 2 04-20-2005 02:02 PM
Webservice calling a webservice.....Error Peter Nordström ASP .Net Web Services 0 10-21-2003 12:02 PM



Advertisments