How to automate task of consuming webservice

前端 未结 2 679
臣服心动
臣服心动 2021-01-23 04:35

I have a winform application which needs to consume a web service. Web service checks in the database for any changes. If there are any changes

2条回答
  •  余生分开走
    2021-01-23 05:30

    That's the only way especially if the web service is not WCF-based or if you can't afford to modify it.

    If you're using a timer just make sure you use System.Timers.Timer and follow the instructions here so that the Elapsed handler is executed on the UI thread. Moreover, when the timer ticks you should probably spawn a worker thread (or Task, or await on an async method) that makes the service call. You don't want your UI to be blocked while the service call is in progress.

    If you have control over the web service, then you may want to explore WCF Duplex Services, which allow you to callback clients from within services.

提交回复
热议问题