Saturday, 09 December 2006

Hi

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 :-)

--
eliasen

Saturday, 09 December 2006 23:24:28 (Romance Standard Time, UTC+01:00)  #    Comments [13]  | 
Friday, 06 April 2007 00:34:08 (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.

-Eugene
Friday, 06 April 2007 09:37:50 (Romance Daylight Time, UTC+02:00)
Glad I could help! :-)
Thursday, 08 November 2007 21:14:35 (Romance Standard Time, UTC+01:00)
You're a saviour! Thanks for posting the solution on the web!
Saturday, 10 November 2007 13:44:09 (Romance Standard Time, UTC+01:00)
Anytime :-)
Wednesday, 28 November 2007 22:09:33 (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?

Thanks
Thursday, 29 November 2007 21:05:11 (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 http://blog.eliasen.dk/PermaLink,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 http://www.competitive.com/TechnologiesUsed.aspx - why isn't BizTalk mentioned? .-)

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

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

Glad I could help.

--
eliasen
Monday, 04 October 2010 16:42:17 (Romance Daylight Time, UTC+02:00)
4 years later, ans still useful ...
But why is it neeeded here and not there ?
Q Ay
Monday, 04 October 2010 20:03:22 (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.

--
eliasen
Tuesday, 05 October 2010 10:09:24 (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:
.../*[local-name()='title']/text()
but this did not worked for me.

Anyway the most important is it works, thanks for all Eliasen!
Q Ay
Tuesday, 05 October 2010 20:58:05 (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...

--
eliasen
Monday, 06 December 2010 17:14:24 (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.
OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
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