Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi, I got a WCF service working with callbacks. Everything works fine when I pass an integer to wcf service, and then the service call back to client another integer.

But when I try to pass a complex type, like List<string> to WCF service, the service cannot call back the CLient.

Anyone has experienced this ??
Need help.
Thanks!
Posted
Comments
Mark Salsbery 25-Oct-11 11:12am    
What do you mean "the service cannot call back the CLient"?
L_Coelho 25-Oct-11 12:03pm    
I mean the Server side cannot send result to client side...

SERVER:
public void GetData(ObservableCollection<People> listValues)
{
Callback.ResultData(listValues);
}

IDuplexCallback Callback
{
get
{
return OperationContext.Current.GetCallbackChannel<iduplexcallback>();
}
}


CLIENT:

// Construct InstanceContext to handle messages on callback interface.
InstanceContext instanceContext = new InstanceContext(new CallbackHandler());

// Create a client.
DuplexServiceReference.DuplexClient client = new DuplexServiceReference.DuplexClient(instanceContext);

client.GetData(observableCollectionPeople);


public class CallbackHandler : IDuplexCallback
{
public void ResultData(ObservableCollection<People> listInt)
{
System.Windows.MessageBox.Show(listInt.Count().ToString());
}
}


When debugging, I enter in the server code. When the server (service) code try to call back the client (Callback.ResultData) it fails with timeout exception.

But if i instead of ObservableCollection I use an integer, it works.
Mark Salsbery 25-Oct-11 19:28pm    
You stated "like List<string>", not ObservableCollection<People>. Is your People class WCF-serializable? Does it work if you use List<People>?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900