Processing Binary Documents as XLANGMessages Through BizTalk Via Web Services

Posted: November 4, 2012  |  Categories: BizTalk Uncategorized
Tags:

Seroter has previously written about this in Processing Binary Documents Through BizTalk Via Web Services. I had to send a binary document to a SharePoint web service but in my case my document payload was not an element inside an XML document. The orchestration payload that contained my document was a un-typed MIME encoded XLANGMessage that had been an attachment on an email. See my previous post (An alternative to using the POP3 adapter to read email attachments) that explains how I got the un-typed document from an email into an orchestration inside BizTalk.

I decided to execute a send pipeline in an orchestration to add the un-typed MIME encoded XLANGmessage to an XML document before sending this onto the SharePoint web service.  First I created a custom pipeline component to;

  1. Read the MIME encoded  document using a BinaryReader into a byte array. Note you cannot use a StreamReader because the data in the stream is base64 encoded and will contain non-ASCII characters.
  2. Convert the byte array to a Base64 encoded string
  3. Create the typed XML document and add the base64 encode string to one of the elements.
  4. Send the XML document back out.

See a more recent blog post for the latest pipeline component code.

I added the custom pipeline component to the encode stage of a custom send pipeline and then executed it in an orchestration. The output is a typed XML document with a stream array element that contains a base 64 string that can then be mapped to SharePoint message a shown in the map below.

New Picture (3)

turbo360

Back to Top