Search code examples
wcfweb-servicesbiztalkpollingbiztalk-2010

BizTalk WCF Service Polling


I need to perform polling on a WCF service inside BizTalk. The workflow would be as follows:

  1. Pool the service (a string is returned, that should be mapped to a schema)
  2. If there's no message available (exception raised/404/empty string/whatever is easier), go to 5
  3. Convert the string into the proper schema, process and forward the message
  4. Go back to 1
  5. Wait for 5 minutes and go back to 1

I've used 'Consume WCF Service' to generate the ports and schemas. But now i cannot find a way to orchestrate this workflow. Here are some questions to which I'm unable to find answers:

  • How can create a scheduled check to see if there's data available in the web service call?
  • How can I cast the XML string from the request into a known schema?
  • Imagine that I would like the message to be casted into a different schema depending on a property from the received XML, how should I do this?

Any help will be much appreciated!


Solution

  • BizTalk is not a job scheduler, but this sort of workflow does comes up a lot when organizations already use BizTalk. Your best bet is to find a reliable (and resilient, monitored, logged, etc.) means of triggering the process, telling BizTalk when it is time to call the WCF service.

    I answered another question about BizTalk scheduling here. From that answer, you may be able to use one of these options for scheduling:

    • The Scheduled Task Adapter on CodePlex - I would only use this if you cannot use another method of triggering your scheduled workflow
    • A Windows Scheduled Task (more difficult to manage, especially prior to Windows Server 2008; you can user Powershell to write a file or to a message queue that BizTalk sucks in to kick off its process)
    • Third-party job scheduling software (particularly if already in use; even SQL Server can do this for you)