Vishal Modi

Architect

  Home  |   Contact  |   Syndication    |   Login
  45 Posts | 0 Stories | 95 Comments | 0 Trackbacks

News

Tag Cloud


Archives

Blogs

Links

Tags

Hi there,

 

Recently we had a requirement to integrate a RESTful Service with BizTalk Server. Well no biggie. You can use WCF – Custom Adapter and use webHTTP binding and add a webHttp Endpoint behavior. Wala. Easy to say, little bit tricky to do.

 

That all is fine, but what if you want to have a polling receive location which needs to go and do an HTTP GET to a RESTful Service. Aahh!! That’s even more trickier. Bunch of you reading this post would have already thought about some or other way of doing it.

 

1. Create a basic windows service which runs at scheduled time and drops a message into BizTalk and Biztalk picks up, a RESTful send port subscribes to that message and do the regular RESTful call.

 

2. Have a SQL Task to drop a message and have a RESTful SendPort to do the regular RESTful call.

 

3. Many more way..

 

But what if we can have a Receive Port itself polling at regular interval and make the RESTful Service call? This eliminates the need of unnecessary windows service or the SQL Task or any other triggering process you think of. Cool right..!!

 

So I came across the BizTalk Scheduled Task Adapter.

 

This is a task scheduling adapter which can execute a prescribed task at a configured time. It comes with few default scheduling tasks like XmlString, FileReader, HttpDownload. Also has few version of it out there which can work with almost all versions of BizTalk Server. Lot of people are using it without any issues.

 

How does it solve our scenario of invoking RESTful Service?

 

Well, I decided to write a custom Task for it which will be invoking the RESTful Service. I tried to make this component pretty generic so that anyone can use it but ofcourse, it also depends upon type of RESTful service you are invoking. Few might need authentication, keys etc. You can always extend it according to your needs. Anyways, below is how you can use it.

 

1. Download and install the BizTalk Scheduled Task Adapter. Here is a blog post on how you can use the defaults Tasks which comes with it.

 

2. Download and Open the RESTServiceAdapterProvider Project in Visual Studio. Compile the code and GAC the assembly if it does not do it by itself.

 

3. Open BizTalk Server Admin Console and create a new Receive Port, Receive Location under your application.

 

4. In the receive location properties, Adapter type = Scheduler. This is the name you give to the BizTalk Scheduled Task Adapter while configuring it. If you don’t see this make sure you go to the Platform Setting à Adapters à New Adapter and from the drop down select the Schedule Adapter and name it whatever you want. In my case, I named it as Scheduler.



 

5. Next click Configure next the Adapter Type. In the configuration window, type the name of Schedule Task you want to give. In this case “RESTfulScheduler”


 

6. Next click the Schedule tab on this window and specify the time you want this scheduler to run.


 

7. Next click the Task tab on the same window and under the Class, click Find Task and Click browse under Assembly Qualified Type Name and select the RESTServiceAdapterProvider.dll from the file location of the RESTServiceAdapterProvider project.


8. In the Assembly Qualified Type Name, select RESTProvider and click Select and its fully qualified name will appear at the bottom and click OK.


9. If you get Invalid Assembly class selected, make sure you Gac the RestProvider dll, close the BTS Admin Console, reopen it and restart the HostInstance and try again.

10. Next specify the URL, Content Type, WebMethod and click Apply, OK.


11. Once you are done configuring, you will see the URI as : schedule://TimeSpan/RESTfulScheduler


12. Next is according to your requirements for the message. You can have pipeline component doing bunch of stuff or have orchestration, schemas, maps, business rules for this message or have a send port subscribing to this message. Anything.

 

You can download the source code of the RESTfulAdapterProvider here

 

So, above you saw way of configuring a BizTalk Receive Location Polling a RESTful Service. Thanks for reading.

 

 

-Vishal Mody

posted on Monday, July 11, 2011 4:55 PM

Feedback

# mr 10/3/2011 8:38 AM natural mole removal
Integrating a REStful service and a biz server was a bit tricky,but you gave full detailed steps to accomplish those tasks...
Thanks

# re: Biztalk receive location polling RESTful Service. (HTTP GET) 10/17/2011 6:53 AM stop smoking self hypnosis
Hello this site is meant to provide information and solve all the doubts.Great to have such sites for comments like these.Thanks for view.

# re: Biztalk receive location polling RESTful Service. (HTTP GET) 3/9/2012 9:19 AM chicago graphic design
I am trying to work this one but I can't seem to figure it out.

# re: Biztalk receive location polling RESTful Service. (HTTP GET) 10/5/2012 1:11 PM betta dave
Im having troubles with this as well

# re: Biztalk receive location polling RESTful Service. (HTTP GET) 8/16/2013 1:54 PM Pabitra Dash
Here is my requirement which I already mentioned couple of times.

I would like to use BizTalk Scheduled Task Adapter in which I would like to get information from a predefined web service with URL like 'http:\\xyz' with some operation like ReadContacts(). Also I would like to pass SOAP header.

What I need here is web service polling(with SOAP header) instead of restful service polling.

Your timely help would be appreciated.

# re: Biztalk receive location polling RESTful Service. (HTTP GET) 8/16/2013 2:22 PM Vishal
@Pabitra

My best suggestion to you will be to download the RESTFul provider which I wrote and modify it to call a WCF SOAP Service instead of RESTFul one, compile it and use the way I have described above.

Another simple but not elegant option is to use the basic out of the box task scheduler adapter for FileStream which will initiate an Orchestration and in that Orchestration you have a Request Response port calling your WCF SOAP service and you go from there.

Hope it helps.

Thanks,

Vishal

# re: Biztalk receive location polling RESTful Service. (HTTP GET) 8/19/2013 3:52 AM Pabitra Dash
As per the steps provided in your link, I wrote a SOAPServiceAdapterProvider. I would like to retrieve from a pre-defined web service with URL https://api.bronto.com/v4/readContacts. Still do I need to create a windows service which uses this web service to poll the data? Where this final XML data would be stored so that I can do processing in Orchestration? Your timely help would be appreciated.

# re: Biztalk receive location polling RESTful Service. (HTTP GET) 9/19/2013 10:05 AM rob
Hi

I'm building this for .NET 4.5 and BizTalk 2013 currently. Are there any known issues with either of these?

Thanks
Rob

# Biztalk receive location polling RESTful Service. (HTTP GET) 9/19/2013 12:54 PM rob
where is this "RESTServiceAdapterProvider" project you refer to?

# re: Biztalk receive location polling RESTful Service. (HTTP GET) 1/10/2018 5:26 AM Awad
I manged the instalation of and configuration of receive location.
I need to get data from API and send it then to a partner that in turn will confirm reception of data as "!flat file "
I am new to biztalk and this project is my first
How to start query from Receive location

I have done send port two send respond to GET data from API
I need you r help to explain how I go about solve the problem take into consideration Orchastration and acknowledgmet message by email.

Thanks


Post A Comment
Title:
Name:
Email:
Comment:
Verification: