Once upon a time there was a client that wanted to save all of the data that BizTalk dealt with into a table for further research. Now there is another client that has asked for the same request “We want to store the BizTalk XML message into a database”
Since it has come up now twice, I might as well publish to everyone how you do it.
In your orchestration, you have a long running orchestration with an atomic scope.
As a orchestration variable, you define a System.String and label it Message.
Identifier | Type |
Message | System.String |
InputMsg | {Input schema} |
As a scope variable you define the following:
Identifier | Type |
StringWriter | System.IO.StringWriter |
TempXmlData | System.Xml.XmlDocument |
XmlTextWriter | System.Xml.XmlTextWriter |
Theexpression shape in your scope, you have the following code:
TempXmlData=InputMsg;
StringWriter=new System.IO.StringWriter();
XmlTextWriter=new System.Xml.XmlTextWriter(StringWriter);
TempXmlData.WriteTo(XmlTextWriter);
Message=StringWriter.ToString();
Now you have the data available to inject into your insert statement that will be sent to the data repository, along with any context data you want to send along with it.