Gorgo.Live.ToString()

Mariusz, Gorzoch tech Blog

BizTalk 2010 and InfoPath integration

with one comment

Today I needed to build a solution where BizTalk will process some data and throw out a InfoPath form with details of processed message. I remember that in the past were I was doing that I used an orchestration and some construct/assign massage shape to achieve that, but today I decided to find if this is really the easiest possible way and guess what ! = this is the most complicated way.

In this post I decided to describe the simplest way I found and believe me it is worth reading if you used orchestration approach in the past. Lately I have an chance to work for a while with one smart person from Denmark, who shows me that BizTalk is done in the way that a lot of thinks can be done really easy (if you know what you are doing ;))

So, where we start:

1. Start by designing your InfoPath form.

Do this by simply grabbing your XML document (the one with is produced by BizTalk and you want to turn it on info InfoPath form). Simply start InfoPath and pick-up option to design your form from XML/XSD document. In my case I manage to design form like the one shown below (not really fancy one):

image

Once you finish, publish your template somewhere where everyone can access it.

2. Create instance of your document

Simply open your form and fill it with data. Once you do it, save this form to desktop and open it with “notepad”. The result in my case is shown below:

image

What we need from that file are the “Processing instructions” or information placed in the header witch are used by explorer (and all other kind of apps) to find out what program should be used to process that file. In my case this section looks like this:

<?mso-infoPathSolution
solutionVersion="1.0.0.2"
productVersion="14.0.0"
PIVersion="1.0.0.0"
href="http://whmpplgdn7121:81/BizTalkInfoPath/Forms/template.xsn"
name="urn:schemas-microsoft-com:office:infopath:BizTalkInfoPath:http—hempel-com-SDS-V100" ?>
<?mso-application progid="InfoPath.Document" versionProgid="InfoPath.Document.3"?>

Most of that staff is constant, but some like ‘”href” are not. Href is pointing to the place were you published you InfoPath template and it tells to InfoPath where he should look for it, when he is rendering your documents for the users.

Mark this entire “processing instruction” section and copy it to your clipboard, we goanna need it in a second.

3. Create send port of file type and “XmlTransmit” pipeline

Go to BizTalk to your favorite app and create a send port of type “File” and Pipeline = “XmlTransmit”:

image

and here goes a trick. Click on the “..” on the right side of the “Send pipeline”. This should open an window for you as shown below:

image

Option with are important for us are :

  • ProcessingInstructionOptions = 0 (0-append processing instruction, 1-create new)
  • ProcessingInstructionScope = 0 (0 – document, 1 – Envelope)
  • XmlAsmProcessingInstruction = here is a place where you should past your processing instructions

Once done, hit “OK” button and try to send document fallowing schema of the document you used to build InfoPath form. This should create an new file for you on the output folder, which you can click and see content in the InfoPath:
image

and once I click on it, the magic happens:

image

nice and simple

Advertisements

Written by Mariusz Gorzoch

16 May 2011 at 20:13

One Response

Subscribe to comments with RSS.

  1. Thanks Mariusz, this is a really helpful post.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: