Click here to Skip to main content
11,482,402 members (75,006 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WCF Server service CLI
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 25-Oct-11 5:56am
Comments
Mark Salsbery at 25-Oct-11 11:12am
   
What do you mean "the service cannot call back the CLient"?
L_Coelho at 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();
}
}


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 at 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)



Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 25 Oct 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100