Author |
Message
|
Maxicat |
Posted: Tue May 14, 2013 3:27 pm Post subject: Mapping Node with custom XPath |
|
|
Newbie
Joined: 14 May 2013 Posts: 5
|
Hi,
I'm trying to build a simple flow that takes a BLOB, treats it as string, replaces parts of the string and puts it back to a queue. I'm using v8.0.0.2.
My flow looks like:
MQInput -> Mapping -> MQOutput
The Mapping Node uses the following custom XPath expression on the BLOB/value field:
fn:replace( fn:string( $value1 ), "a", "*" )
The flow runs fine but the message payload isn't changed at all.
What did I miss?
Another annoying problem is that when an exception occurs in the Mapping Node, the debugger isn't very helpful and just says 'source not found'.
-S. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue May 14, 2013 10:06 pm Post subject: Re: Mapping Node with custom XPath |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Maxicat wrote: |
Another annoying problem is that when an exception occurs in the Mapping Node, the debugger isn't very helpful and just says 'source not found'.
-S. |
All the more reason to get familiar with using UserTrace. You might be pleasantly surprised at the help it will give you. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Maxicat |
Posted: Wed May 15, 2013 12:32 am Post subject: |
|
|
Newbie
Joined: 14 May 2013 Posts: 5
|
Thanks. I wonder if the toolkit has a view that displays the User Trace? it's counter productive going back and forth between the toolkit and the command line. |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 15, 2013 4:28 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Maxicat wrote: |
it's counter productive going back and forth between the toolkit and the command line. |
No it isn't.
And no it doesn't. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mgk |
Posted: Wed May 15, 2013 5:38 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi, assuming you choose the BLOB schema for your map Input and Output, this XPath should work for you:
xs:hexBinary(replace(string($value), "61", "2a"))
(where "61" and "2a" are the ASCII codes for "a" and "*" respectively).
Kind regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
Maxicat |
Posted: Wed May 15, 2013 6:44 am Post subject: |
|
|
Newbie
Joined: 14 May 2013 Posts: 5
|
Thanks
Is it possible to translate this literal char representation to a human-readable string? i.e. fn:replace( fn:blob_to_string( $value1 ), "a", "*" ) |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed May 15, 2013 7:12 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Maxicat wrote: |
Thanks
Is it possible to translate this literal char representation to a human-readable string? i.e. fn:replace( fn:blob_to_string( $value1 ), "a", "*" ) |
What does the 'BLOB' look like inside your flow?
Put a trace node set to
${Root.BLOB}
and look for yourself. Then ask yourself that question again.
It would have only take a minute or two to do this. A lot quicker than asking a question that you could have answered for yourself. The side effect of finding out for yourself is that you will remember it far longer than you do if you are simply told the answer. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
kimbert |
Posted: Wed May 15, 2013 7:26 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I wonder if the toolkit has a view that displays the User Trace? |
No it doesn't, but I agree that it would be a useful feature. Vitor's point ( at risk of putting words into his mouth ) is this: the effort of taking a user trace is sometimes repaid many times over. Even if it's a bit of a hassle.
I'm not saying that other debugging techniques should be discarded - but there are times when you need to know *why* things have happened, and the debugger can't tell you. |
|
Back to top |
|
 |
Vitor |
Posted: Wed May 15, 2013 7:34 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
at risk of putting words into his mouth |
If anyone puts words in my mouth, you're welcome to.
kimbert wrote: |
the effort of taking a user trace is sometimes repaid many times over. Even if it's a bit of a hassle. |
Quite.
It's also possible to eliminate much of the "hassle" with scripts, desktop shortcuts and other methods. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Maxicat |
Posted: Thu May 16, 2013 1:09 pm Post subject: |
|
|
Newbie
Joined: 14 May 2013 Posts: 5
|
|
Back to top |
|
 |
|