Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

%MessageID% within orchestration?

Status
Not open for further replies.

BobDuckworth62

Programmer
Feb 15, 2005
12
GB
Hi again

I am processing an XML message which has an element that represents an internal MessageID. What would be nice would be to assign to that element the %MessageID% BizTalk has given the message within the orchestration ... can I do this and, if so, how??

Alternatively, is there a message id generator function I can get at within the orchestration?

Thx in advance

Bob
 
Sure you can.

In an Expression shape you can extract the MessageID as well as all other Context Properties like this:

myMessage.id = myMessage(BTS.MessageID);

Stephan


 
Perfect!

I bought the book MS BizTalk Server 2004 Unleashed, and find this a great source for info for certain things (like building components in C#), but it is not designed to get at this sort of basic info.

Could you recommend a good source for this sort of thing?

I owe you beers already.

Bob
 
Hi Stephan

actually I am having trouble with this (sorry).

When I receive a message I can retrieve its BTS.MessageID into a System.String variable. Fine.

Then I use a map to transform it into a new message.

In any expression after that the BTS.MessageID for the new message is null. It says

"There is no value associated with the property 'BTS.MessageID' in the message"

Any ideas?

Cheers

Bob
 
Ok this is becoming more wierd and irritating(!)

I have an orchestration that does the following:
- <Receives> a message from a CSV text file into a schema
- <Constructs> a new message based on a new schema using a map within a <transformation>
- Uses an <expression> to capture the of the new message BTS.MessageID into a System.String variable
- Uses a <MessageAssign> within a <Construct> to create a new message which has the same schema as the intermediate one (i.e. newMsg = intermediateMsg;) and then assigns the captured BTS.MessageID to a distinguished field in that message (newMsg.ChildElement.MessageID = vblMsgID;)
- <Sends> the final xml out to a directory

When I run the above throught the debugger, one shape at a time, it all works ok. I can see that the BTS.MessageID has been written successfully to my output XML message.

When I remove all the breakpoints and push the same input message through the instance is terminated with the message "There is no value associated with the property 'BTS.MessageID' in the message".

Incidentally, when I step through the debugger I see that all of the objects in the orchestration lose their values after each later <construct> shape - e.g. the original input message gets set to null after the first <construct>, then intermediate message gets set to null after the second <construct>. This does not seem right.

I am sure I am missing some simple orchestration property somewhere because this all seems too basic to be a genuine BizTalk problem.

Please help!

Best regards

Bob
 
Sorry, I never experienced the same thing! Did you set your Orchestration Transaction to longRunning?
Maybe its got something to do with that!

Do you have a place where you could upload your solution, so I could try myself?

Stephan
 
I have transaction set to "none" as I shouldn't really need one.

I can email the solution to you...

Sorry for all the hassle - and thanks for the patience so far!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top