Saturday, December 9, 2006


I ran into this issue today. It turned out that the error occured in an expression shape that used xpath to get a value from a message into a variable.

Having been using xpath expressions inside my orchestrations for a long time, I am really not used to having them fail on me :-) And this particular xpath expression was copied from the "Instance XPath" property of the element in the schema editor. So it shouldn't fail. I did add a "[1]" to the xpath because I needed to access the first element of a re-occuring element, but still - not something I hadn't done plenty of times before.

Actually, it took quite some time before I discovered what was wrong. My expression was:

DeliveryDate = xpath(OrderMessage, "/*[local-name..........");

and I needed to change it to

DeliveryDate = xpath(OrderMessage, "string(/*[local-name..........)");

Again, something I have done a million times... this time I just forgot it. And honestly, I really don't think the error message gives a very good idea of what is wrong...

Hope this gets indexed and someone later on will find it helpful :-)


Saturday, December 9, 2006 11:24:28 PM (Romance Standard Time, UTC+01:00)  #    Comments [13]  | 
Friday, April 6, 2007 12:34:08 AM (Romance Daylight Time, UTC+02:00)
Thanks for a great post! I got this error and could not even guess as to how to start diagnosing it. You saved me hours of work. Thanks again.

Friday, April 6, 2007 9:37:50 AM (Romance Daylight Time, UTC+02:00)
Glad I could help! :-)
Thursday, November 8, 2007 9:14:35 PM (Romance Standard Time, UTC+01:00)
You're a saviour! Thanks for posting the solution on the web!
Saturday, November 10, 2007 1:44:09 PM (Romance Standard Time, UTC+01:00)
Anytime :-)
Wednesday, November 28, 2007 10:09:33 PM (Romance Standard Time, UTC+01:00)
I'm getting this error but I'm not trying to assign the xpath result to a string. I'm trying to assign it to a BizTalk message variable. If the xpath expression returns a single XmlElement (and its child elements), isn't that a valid result to assign to a message? If not, how do I get my message to contain the XML returned from the xpath expression?

Thursday, November 29, 2007 9:05:11 PM (Romance Standard Time, UTC+01:00)
Hi Zoe

So, I might even be able to help you outside the newsgroups this time? :-)

Anyway, take a look at,guid,6c7ac8ec-3f3e-49e4-a15a-76c736d30654.aspx - I am actually doing what you want to do, I think. See if there is any difference. If all fails, email me your project and I will look at it.

Oh yeah, and take a look at - why isn't BizTalk mentioned? .-)

Friday, October 24, 2008 10:50:30 AM (Romance Daylight Time, UTC+02:00)
Almost 2 years later, you also helped me out with this post :-)

Saturday, October 25, 2008 5:46:01 PM (Romance Daylight Time, UTC+02:00)
Well, good information never expires! :-)

Glad I could help.

Monday, October 4, 2010 4:42:17 PM (Romance Daylight Time, UTC+02:00)
4 years later, ans still useful ...
But why is it neeeded here and not there ?
Q Ay
Monday, October 4, 2010 8:03:22 PM (Romance Daylight Time, UTC+02:00)
Hi Q Ay

Yes, still uefull...

Needed here and not there? Not sure what you mean... it is needed whenever you want to get the value of a node and not the node itself... It should be pretty consistent.

Tuesday, October 5, 2010 10:09:24 AM (Romance Daylight Time, UTC+02:00)
This one for instance, and many others as I have been working from time to time with BTS since 2004, works perfectly (get name from a SharePoint list):
data = xpath(GetListItemsResponse, "//*[local-name()='data']/*[local-name()='row'][1]/@ows_Name");

With this one I spent about one full day, and some hairs and neurons, before I added the "string()" function:
v1 = xpath(In, "string(/*[local-name()='messageX']/*[local-name()='attachment'][1]/*[local-name()='title'])");

Note both data and v1 are defined as strings, GetListItemResponse and In as schema-based messsages.

Another blog related to the same error ("<element xmlns=''> was not expected") solved it using the /text() xpath function:
but this did not worked for me.

Anyway the most important is it works, thanks for all Eliasen!
Q Ay
Tuesday, October 5, 2010 8:58:05 PM (Romance Daylight Time, UTC+02:00)
Hi Q Ay

Well, it appears to me that for attributes you don't need the string function, but for elements you need it. Haven't tested...

Monday, December 6, 2010 5:14:24 PM (Romance Standard Time, UTC+01:00)
Thanx. You saved me for some useless debug :-)
All comments require the approval of the site owner before being displayed.
Please login with either your OpenID above, or your details below.
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview

Theme design by Jelle Druyts