Geeks With Blogs
Stas Kondratiev's Blog blog

If you worked with InfoPath you must know about processing instructions that it uses to treat an XML file as an InfoPath form. If your orchestration receives such a file, alters its data and then sends it out, you should keep these processing instructions to be able to view your file as an infopath form. InfoPath (SP1) uses 2 PI's:


<?mso-infoPathSolution name="urn:schemas-microsoft-com:office:infopath:Form1:http---rgs-ru-Form1" href="file:///C:\YourInfoPathForm\manifest.xsf" solutionVersion="" productVersion="11.0.6357" PIVersion="" ?>


The value of “href” depends on the location of your xsn or manifest (template) file. If you use simple assignment when constructing the out message, processing instructions will be copied into the out message automatically. If you use map you have an option of copying PI's on the properties sheet of the map grid. Unfortunately this option won't help if your map has more than one input scheme. In such a case you may copy PI's explicitly in the expression shape as described in the Blogger's guide. There's a drawback however. If you redeploy/relocate your InfoPath form template (xsn) you'll have to modify the orchestration. Not the best option, especially taking into account the fact that PI's are contained in the message.

Here's the solution I propose. In your orchestration declare a string variable (strProcessingInstructions) that will store the processing instructions. Put an atomic scope and declare an XmlNodeList (nodeList) and XmlNode (node) variables in it. We need a scope with the atomic transaction type because XmlNodeList and XmlNode are not serializable. Put an Expression shape into the scope and type the following in it:


nodeList = xpath(InputMessage, "processing-instruction()");

if (nodeList.Count > 0) { node = nodeList.Item(0); strProcessingInstructions = strProcessingInstructions + node.OuterXml; }

if (nodeList.Count > 1) { node = nodeList.Item(1); strProcessingInstructions = strProcessingInstructions + node.OuterXml; }

if (nodeList.Count > 2) { node = nodeList.Item(2); strProcessingInstructions = strProcessingInstructions + node.OuterXml; }

if (nodeList.Count > 3) { node = nodeList.Item(3); strProcessingInstructions = strProcessingInstructions + node.OuterXml; }

if (nodeList.Count > 4) { node = nodeList.Item(4); strProcessingInstructions = strProcessingInstructions + node.OuterXml; }


The list of if's may be as long as you think the number of processing instructions in the message are. In the case of InfoPath the number is 2 so the last 3 conditions are redundant. As another option we could use a Loop shape and get rid of the hardcoded number of if's but in my case a Loop shape would be too much :-).

Now when constructing the out message, put the following lines in a Message assignment shape:


OutMessage(XMLNORM.ProcessingInstructionOption) = 1;

OutMessage(XMLNORM.ProcessingInstruction) = strProcessingInstructions;


Here you go. Your processing instructions will be transferred to the out message and the document will look as as infopath form.

Posted on Tuesday, June 14, 2005 1:09 PM BizTalk | Back to top

Comments on this post: InfoPath Processing Instructions

# re: InfoPath Processing Instructions
Requesting Gravatar...
worked with InfoPath
Left by jimmy on Nov 09, 2009 1:32 AM

# Manumitted Wp Themes
Requesting Gravatar...
Good brief and this fill someone in on helped me alot in my college assignement. Thanks you as your information.
Left by WP Themes on Feb 12, 2010 1:48 PM

Your comment:
 (will show your gravatar)

Copyright © Stas Kondratiev | Powered by: