locked
poll a webservice every X minutes (with WCF-BasicHttp and/or WCF-WSHttp adapter) RRS feed

  • Question

  • I have a webservice (not WCF based) out there.  I want BizTalk to be a webservice client to it and send in a request every 10 minutes.  If webservice's response meets some criteria (is non-empty, non-fault, etc.) then I want to send that data into BizTalk MsgBox and subscribing orchestrations, etc.

    Is this possible?  Nothing jumps out at me in http://msdn.microsoft.com/en-us/library/bb246064.aspx

     

    Any tips, tricks, samples for accomplishing this scenario with BizTalk 2006 R2 (and WCF-BasicHttp or WCF-WSHttp, if possible) are appreciated.

    Wednesday, May 7, 2008 4:50 PM

Answers

  • Hi,

     

    This has been quite a common question.

     

    There's nothing out of the box that will allow you to poll a web service, but there are a few workarounds, some better than others.

     

    (1) The SQL adapter can be configired to poll a stored procedure every 10 minutes, then creata an orchestraion instance on any received message. If the stored proc always returns a message, you can then get the orchestration to call the web service then process the message.

     

    (2) Have a singleton orchestration that calls the web service, then delays 10 minutes, in a while-true loop. Use a controll message to start the orchestration.

     

    (3) Build a web service polling adapter using the LOB adapter SDK.

     

    (4) Build a web service polling adapter using the BizTalk Adapter framework.

     

    Building an adapter is not an easy task, but it's easyer with the LOB SDK than the BizTalk Adapter framework. Options 1 and 2 are a bit hacky but it might be worth building a POC to see if it does what you want. With option 1 you will need a database with a stored proc, with option 2 the pollng will stop if the orcherstration suspends.

     

    Regards,

     

    Alan

     

     

    Wednesday, May 7, 2008 5:47 PM

All replies

  • Hi,

     

    This has been quite a common question.

     

    There's nothing out of the box that will allow you to poll a web service, but there are a few workarounds, some better than others.

     

    (1) The SQL adapter can be configired to poll a stored procedure every 10 minutes, then creata an orchestraion instance on any received message. If the stored proc always returns a message, you can then get the orchestration to call the web service then process the message.

     

    (2) Have a singleton orchestration that calls the web service, then delays 10 minutes, in a while-true loop. Use a controll message to start the orchestration.

     

    (3) Build a web service polling adapter using the LOB adapter SDK.

     

    (4) Build a web service polling adapter using the BizTalk Adapter framework.

     

    Building an adapter is not an easy task, but it's easyer with the LOB SDK than the BizTalk Adapter framework. Options 1 and 2 are a bit hacky but it might be worth building a POC to see if it does what you want. With option 1 you will need a database with a stored proc, with option 2 the pollng will stop if the orcherstration suspends.

     

    Regards,

     

    Alan

     

     

    Wednesday, May 7, 2008 5:47 PM
  •  

    Thanks, this gives some good first direction.

    I have some experience with WCF LOB Adapter SDK, so I personally will lean that direction.

     

    Will Microsoft enhance the WCF-BasicHttp adapter in 2.0 and/or have a good sample for this scenario in BizTalk 2006 R3 ?

    Thursday, May 8, 2008 2:22 PM
  • Hi,

     

    >>Will Microsoft enhance the WCF-BasicHttp adapter in 2.0 and/or have a good sample for this scenario in BizTalk 2006 R3 ?

     

    As R3 is at the early stages of development they are looking for feedback regarding improvements that could be made. If you send in a comment describing the problem and what you would like to see as a solution I'm sure it will e condidered.

     

    I'd agree that a web service polling adapter would be great to have either included in the product or as a sample.

     

    There is an email link to contact the relevant people on the Adapters blog:

    http://blogs.msdn.com/adapters/

     

    Regards,

     

    Alan

     

     

     

    Thursday, May 8, 2008 2:30 PM
  • Another design option to the 4 above is to use the Schedule Task Adapter (http://biztalkscheduledtask.codeplex.com/) to receive a message that an orchestration subscribes to.  This orchestration calls the service.

    I too would prefer this functionality in an out-of-the box adapter.  I added a suggestion on Microsoft Connect for future consideration. See: http://connect.microsoft.com/BizTalk/feedback/details/652596/poll-wcf-services-adapter. Please vote for it.

    • Proposed as answer by charlie.mott Monday, March 28, 2011 2:53 PM
    Monday, March 28, 2011 2:53 PM
  • We ended up running a scheduled task (under the Windows scheduler, but you could use any scheduling tool) that creates a "control message" and drops it in a folder.  BizTalk watches the folder, and when it sees the control message it calls the web service.  This allows for very flexible scheduling.  You could poll the web service every other Wednesday at 3:00 PM if you want to.
    Monday, March 28, 2011 6:14 PM