Monday, June 25, 2007

Transfering files with BizTalk Services

BizTalk Services has been out for a few weeks, but only recently did I have the time to try out the samples included in the June SDK. BizTalk Services is one of Microsoft's moves in the Saas (or rather, S+S) game, and is self-described as an Internet Service Bus (ISB), and is not related to the BizTalk Server line of products, consisting more of an additional functionality stack on top of the Wcf framework, hosted in the cloud.

Channel 9 published a 30-minute video about BizTalk Services which I recommend. The video includes demos of some of the samples included in the SDK, like the Echo and Multicast/Pub-Sub ones.

I have tried several of the samples, starting with the Echo. This short sample includes a simple setup of Wcf service and client, but with the communication between the two being done via the ISB, using a relay binding which allows two-way communication between service and client. The interesting part of this is that you can go through firewalls (it just works, much like Office Groove). I played with the different instancing modes and several simultaneous clients (all of them work as expected), checked how long it takes for the client to get the reply back (a little less than a second) and how big could the echo message be (8k). A somewhat annoying aspect of this sample is that CardSpace's identity selector keeps popping up, both when starting the client and the server.

Anyway, it's a great starting point, and I quickly wrote a simple file transfer service, something I could use (with the appropriate security, obviously) to get files from my company's file share when I have no VPN connectivity.

The service implements a GetFile contract, receiving as parameters the filename, size of page/block/chunk, and page number, and returns a byte array. The service's instance mode is PerCall.

The client app asks the input for a path to a file located on the server, and gets it page by page, saving it to the C:\Incoming folder.

Download the code bellow. 

There are two other samples posted on the net which I recommend: Clemens Vasters' "Tweetiebot" and Christian Weyer's post "safe and secure WCF duplex callbacks through NATs and firewalls".

No comments:

Post a Comment