Yossi Dahan [BizTalk]


Wednesday, August 03, 2005

xpath method gotcha (or I must be missing something...)

In case there's someone out there that still didn't find out about it, there's a magnificent method called xpath you can use in orchestrations.

In any expression type xpath([message],"[xpath expression]") and you get back whatever the xpath expression you've provided points to in your message (a node, a node set, a string).

Very useful when you need to check for values in the message for a decision or a loop, extracting values to use in other places or even extracting bits of a message an assigning them to another (did someone mention message splitting?)

now, I've been doing a bit of all of that this week and must have gotten really tired because in several places I simply forgot to put in the message. So I called the xpath method with a single parameter - the xpath expression.

strangely enough this did not cause any compile time error. Even more strange - it did not even cause a runtime error. It simply returned an empty string.

This one took me a while to figure out (as well as bugging Scott Colestock and Marvin Smith on the newsgroups - thanks guys), but when I did find out how silly I was, right after I hit myself, I started *blessing* BizTalk because unless I'm missing something this is very unexpected behaviour.

BTW - for those of you who are wondering - I've just tried that on BizTalk 2006 and the behaviour is the same.


Post a Comment

<< Home