Preserve Processing Instructions in BizTalk

  • 28 June 2005
  • 1 reply
  • 0 views

Badge +1
Hello,

I'm working on integrating K2 and BizTalk 2004. In my orchestration I do the following steps.

1. Receive from K2
2. Map K2 to Schema2 (copy processing instructions checked)
3. Send Schema2 through 3rd party adapter (Request-Response)
4. Map adapter Response back to K2 schema (copy processing instructions checked)
5. Send results to K2

My problem is that the 3rd party adapter does not preserve the processing instructions. I'm trying to figure out how I can get the processing instructions from the original K2 message back on the message I'm sending back to K2.

I've found a command that will let me append processing instructions values to a message. However, I haven't been successfull in getting the processing instructions out of the original message.

Has anyone found a way to do this?

Thanks,

1 reply

Badge +1
With a little help, we were able to resolve our problem. We wrote the following function to return the processing instructions from a message.

Public Function GetK2ProcessingInstructions(ByVal message As System.Xml.XmlDocument) As System.String

Dim procInstruction As String

' Loop through the nodes in the message.
For Each node As Xml.XmlNode In message.ChildNodes

'Check to see if the current node is a processing instruction.
If node.NodeType = Xml.XmlNodeType.ProcessingInstruction Then

'Grab the processing instruction value and exit the loop
procInstruction = node.InnerText()
Exit For

End If
Next

'Add the K2 processing instruction tags and return the results.
Return "<?K2-Biztalk " + procInstruction + "?>"

End Function

Then, we added a message assignment in our orchestration with the following code. K2MessageIn is the original message from K2 and K2MessageOut is the message we send back to K2.

K2MessageOut(XMLNORM.ProcessingInstructionOption) = 0;
K2MessageOut(XMLNORM.ProcessingInstruction) = BizTalkClassLib.GetK2ProcessingInstructions(K2MessageIn);

Reply