问题
I have WCF service
When I "Add Service Reference" in my windows phone application everything looks good but methods return void. I tested this server for example in WPF app and it works and returns what I need but in wp 7/8 app not. Ofcourse the basic functionality of this WCF is to return data so void methods are totally useless for me.
回答1:
You can use service Async
and Completed
events.Service will return data in completed
event like
ServiceReference1.Service1Client clientForTesting = new ServiceReference1.Service1Client();
clientForTesting.GetDataCompleted += new EventHandler<ServiceReference1.GetDataCompletedEventArgs>(TestCallback);
clientForTesting.GetDataAsync(testValue);
来源:https://stackoverflow.com/questions/19616958/consume-wcf-service-in-windows-phone-application-methods-return-void