Here’ the situation.
I have a sequence of 12 integration tasks to be run every 15 minutes, most of them actually reading something from the oracle server and pushing it into a web service. I have created a port for both oracle and web service and I created a main orchestration which loops every 15 minutes and calls other orchestrations that will do their tasks.
Now, my problem is that those orchestrations are not invoked by a message arrival, and I have a need to construct a message that I will send to the oracle port. The one that will look like this:
<Select xmlns="http://Microsoft.LobServices.OracleDB/2007/03/HR/Table/EMPLOYEES">
<COLUMN_NAMES>*</COLUMN_NAMES>
<FILTER>DATE=somedate</FILTER>
</Select>
I know what the node values will be but I do not know how to construct the message other than to use “magic strings” and concatenating strings that I will load into xmlDoc using LoadXml and then assigning that to message parameters which I would very much like to avoid for a lot of reasons (starting with a change in namespace in the future). Is there a way for orchestration to create the “blank” message which I will then fill in?
Maybe the question is very simple and I can’t see the tree from the forest, but all the samples I saw on the net are simplified (meaning someone just drops a ready xml in a watched folder to invoke orchestration) and do not help me.
Here’s a solution I implemented for a similar problem: As Hugh suggests I use a helper inheriting from XmlDocument.
The Xml Template class
Of course my expample targets a fixed attribute
valueto be set so you’ll have to adapt this to your needs.The QueryValues helper class
The Xml Template
Add a Xml doc MyTemplate.xml to your project and change the compile action to
Embedded Resourceso ResorceXmlDocument can load it via Reflection.Orchestration variables and Messages
You’ll need to declare
Putting it together inside a Message Assignment Shape
inside a Construct Message Shape creating a Message MyRequest of type MySchemaType
I’m keeping
ResourceXmlDocumentandQueryValuesin a util lib and reference it from any BizTalk project I need. The various Xml template docs are embedded into the respective BizTalk assembly.EDIT by OP: Actually the only way I go this to work is to also implement
ISerializableonResourceXmlDocumentand persist message using custom serialization of OuterXml. The XmlDocument in the base is simply not serializable on its own. If there is another approach, feel free to edit this.