I create a WCF recreation service and this is a client. I plan that the client does not know much about the service, just the right URL to call the methods and the expected results.
My service contract:
[WebInvoke(Method="POST", UriTemplate="/tasks")] [OperationContract] void SubmitTask(Transaction task); [WebGet(UriTemplate = "/tasks/{taskId}")] [OperationContract] [XmlSerializerFormat] Transaction GetTask(string taskId);
SubmitTask is implemented as follows:
SubmitTask(Transaction task) { DoSomethingWithTask(task); task.Status = "SomeStatus"; DoSomethingElseWithTaks(task); task.Status = "SomeOtherStatus"; }
What do I expect from a client:
ButtonClick() { SubmitTask(task); while(true) { string status = Transaction GetTask(task.taskId).Status; Textbox.Text+= status; if(status==ok) break; Thread.Sleep(1000); } }
The problem is that GetTask is not running on the service side and all SubmitTask operations are complete, so I only get the latest status of the task on the client side. How to implement asynchronos in this situation?
Thanks in advance!
source share