Http Post

Asked By Sania
19-Aug-10 11:46 AM
Earn up to 0 extra points for answering this tough question.
Hi,

I have a scenario where I need to download a zip file from a website url.There is no webservice provided. Its just a website where I can see a zip file has been uploaded and I need download a zip file at a scheduled time , unzip it and store it into database.As far as unzipping the file and loading is concerened,I am fine with that and developed the unzip custom pipeline and loaded data. I thought I could use HTTP adapter to download the file but Http does not work like that. Is there a way I can download a zip file using any adapter in Biztalk from a website url and doing a simple configuration or I have to write a custom component/pipeline? Any help will be highly appreciated.

Thanks
Sania
   

  re: Http Post

Mohan Raj Aryal replied to Sania
21-Aug-10 03:18 PM
Hi Sania, 

By default If you try to use HTTP Receive Adapter (or Two way HTTP Receive Port) It is not possible Because unless you give HTTPRequest to the destination web server, the server doesn't send you Response Back. Another problem I can see is how you will know that the new message is arriving? 

IIS hosts the HTTP receive adapter and accepts HTTP requests that contain messages. The receive location for the HTTP receive adapter is a distinct URL configured through BizTalk Explorer. I can Imagine downloading one file with the help of HTTP Request-Response port by Configuring Request port to the destination URL of the file to be downloaded. If the website always gives the new message via HTTPResponse, it should be okay, but note that you again need to create HTTPRequest to the URL always. That means If you are using this port (HTTP Request-Response) inside orchestration, then your requirement is fullfiled (I personally don't feel this is what you are trying to do)

How about writing a simple Windows Service application which continuously downloads the file from URL and saves the file inside a folder. Once this is done your BizTalk file receive adapter can picks up your file. I would recommend this solution.  For this you can do something like: 
System.Net.WebClient webClient = new WebClient();
Stream downloadedStream = Client.OpenRead("http://www.YourDomain.com/downloads/file.zip");
Here you will have downloaded content on Stream. Now you can save the file to BizTalk Receive location


  re: Http Post

Sania replied to Mohan Raj Aryal
23-Aug-10 10:46 AM
Hi Mohan,

Thanks for the response. I was also thinking to create a windows service application using the same method But the problem is that the zip file has no absolute url. I cannot write "http://www.YourDomain.com/downloads/file.zip" as command. When I try to open my zipfile on internet explorer as the given command it gives me  error(Page not found). I have to first go to the following webpage http://www.cms.gov/MedicareProviderSupEnroll/06_MedicareOrderingandReferring.asp after that I need to click on the zip to download (Medicare Ordering and Referring File [ZIP, 64400 KB] ).

Is there a different syntax to download this kind of synario?

Thanks
Sania

  re: Http Post

Mohan Raj Aryal replied to Sania
23-Aug-10 12:45 PM
Clicking can't be done because it is the event that is triggered by user. If your zip file doesn't have absolute URL, you can try reading the HTTPResponse from your URL http://www.cms.gov/MedicareProviderSupEnroll/06_MedicareOrderingandReferring.asp. Once you have the Stream, you can parse this in order to identify the URL of Zip file from HTML contents.

I hope this helps to you !
Create New Account