|
Home > Archive > BizTalk Server General > June 2005 > How do you copy processing instructions between messages without a
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How do you copy processing instructions between messages without a
|
|
| Ellen Deak 2005-06-09, 5:51 pm |
| Hello,
I have a scenario where I receive a message that contains processing
instructions, do some processing and then send a message back that needs to
also contain the processing instructions.
In my orchestration, I do the following.
1. Receive in the message
2. Map the message to format needed by adapter. On map, Copy Processing
Instructions is yes.
3. Invoke 3rd part request-response adapter. Send message generated in step
2 and receive back a response message.
4. Map the response message from step 3 to final message. On map, Copy
Processing Instructions is yes.
5. Send final message.
The problem I have is that the response message I get back from the adapter
no longer has the processing instructions with it. I'm trying to figure out
another way to copy the processing instructions from the inital message to
the final message before I send it.
Does anyone have any suggestions?
Thanks
--
Ellen Deak
using BizTalk 2004
| |
| Stephen W. Thomas 2005-06-09, 5:51 pm |
| Hello.
Another way to do it is to copy the processing instructions from your first
message to your final message using message context. After you complete your
final map, inside the same message construct shape add a message assignment
shape.
Use this code:
// 1 = Add New 0 = Append
OutputMessage(XMLNORM.ProcessingInstructionOption) = 1;
OutputMessage(XMLNORM.ProcessingInstruction) =
FirstMessageReceived(XMLNORM.ProcessingInstruction) ;
Also, I think you will need to use the Xml pipeline on the Send side to
demote the processing instructions into the message.
FYI: Setting values like this inside the Orchestration will override any
properties you might set inside the pipeline.
Hope this helps.
Stephen W. Thomas
http://www.biztalkgurus.com
"Ellen Deak" wrote:
> Hello,
>
> I have a scenario where I receive a message that contains processing
> instructions, do some processing and then send a message back that needs to
> also contain the processing instructions.
>
> In my orchestration, I do the following.
>
> 1. Receive in the message
> 2. Map the message to format needed by adapter. On map, Copy Processing
> Instructions is yes.
> 3. Invoke 3rd part request-response adapter. Send message generated in step
> 2 and receive back a response message.
> 4. Map the response message from step 3 to final message. On map, Copy
> Processing Instructions is yes.
> 5. Send final message.
>
> The problem I have is that the response message I get back from the adapter
> no longer has the processing instructions with it. I'm trying to figure out
> another way to copy the processing instructions from the inital message to
> the final message before I send it.
>
> Does anyone have any suggestions?
>
> Thanks
> --
> Ellen Deak
> using BizTalk 2004
| |
| Ellen Deak 2005-06-29, 5:51 pm |
| I finally found a way to copy processing instructions from one message to
another and thought I would post the full solution.
First, we wrote the following function.
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 the following code to a message assignment in our
orchestration. K2MessageIn is the original message containing the processing
instructions and K2MessageOut is the message we are sending that needs the
processing instructions included.
K2MessageOut(XMLNORM.ProcessingInstructionOption) = 0;
K2MessageOut(XMLNORM.ProcessingInstruction) =
BizTalkClassLib. GetK2ProcessingInstructions(K2MessageIn)
;
--
Ellen Deak
|
|
|
|
|