Author |
Message
|
JosephGramig |
Posted: Thu May 21, 2015 7:25 am Post subject: Set CorrelId in the GDM |
|
|
 Grand Master
Joined: 09 Feb 2006 Posts: 1244 Location: Gold Coast of Florida, USA
|
OK, I can see that the MsgId and CorrelId are hexBinary in the GDM.
I need to set the CorrelId to a specific value from a string.
Tried xs:hexBinary('Some Crazy Stuff the App does'), but I get "The operand cannot be cast to type 'xs:hexBinary'".
Some assistance would be nice.
I'm actually composing the CorrelId from data in a MQ request (before the request is made).
BTW in XPath, are strings enclosed in single '' or double "" quotes? I've been using double and that works but maybe it one is more right... |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu May 21, 2015 7:46 am Post subject: Re: Set CorrelId in the GDM |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
JosephGramig wrote: |
OK, I can see that the MsgId and CorrelId are hexBinary in the GDM.
I need to set the CorrelId to a specific value from a string.
Tried xs:hexBinary('Some Crazy Stuff the App does'), but I get "The operand cannot be cast to type 'xs:hexBinary'".
Some assistance would be nice.
I'm actually composing the CorrelId from data in a MQ request (before the request is made).
BTW in XPath, are strings enclosed in single '' or double "" quotes? I've been using double and that works but maybe it one is more right... |
Have you tried setting this crazy correlID in JMS?.
There are specific rules in JMS when using RFH2 folder.
The correlID as string goes to some folder in the RFH2 (full length). The correlId gets cut at 24 bytes and those get set in the correlID field of the MQMD. This is what gives the correlID in form ID:xxxxxxxx hex value which is a String (JMS). (51 long).
When checking for the correlID, set the correlID in String form (JMS) and then immediately retrieve it from the message and you might get the ID:xxxx form (padded with zeros to the right) or the full String if it was over 24 bytes long...
You could try playing with it (both fields are in RFHUtil)...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Thu May 21, 2015 7:57 am Post subject: Re: Set CorrelId in the GDM |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
fjb_saper wrote: |
Have you tried setting this crazy correlID in JMS?. |
I'm not sure that's strictly relevant to using the GDM to set a CorrelId field in OutputRoot.MQMD.CorrelID... |
|
Back to top |
|
 |
JosephGramig |
Posted: Thu May 21, 2015 9:08 am Post subject: |
|
|
 Grand Master
Joined: 09 Feb 2006 Posts: 1244 Location: Gold Coast of Florida, USA
|
Martin B. has confirmed there is no handy XPath function to convert characters (string) to hex encoded.
He indicated you could if you stand on your head and fart the Star Spangled Banner...
I'm now going to backup the truck and write a custom Java method to do this.
Funny how the GDM requires a great deal more effort to do a complex msg xform than just plain old code... |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu May 21, 2015 9:31 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
What happens if you just / only set it in the JMS folder of the RFH2 header (as string).
Does it get correctly translated to the MQMD on the Written destination?
Instead of looking for a transform function did you try to cast the string as BLOB?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Thu May 21, 2015 2:45 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Martin B. has confirmed there is no handy XPath function to convert characters (string) to hex encoded.
He indicated you could if you stand on your head and fart the Star Spangled Banner... |
[quote]That workaround only applies if you're using v9.0.0.3. In earlier versions, you have to sneeze the Post Horn Gallop. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri May 22, 2015 4:38 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
kimbert wrote: |
Quote: |
Martin B. has confirmed there is no handy XPath function to convert characters (string) to hex encoded.
He indicated you could if you stand on your head and fart the Star Spangled Banner... |
That workaround only applies if you're using v9.0.0.3. In earlier versions, you have to sneeze the Post Horn Gallop. |
I've had reasonably good luck accomplishing complicated GDM maps while burping Jerusalem. |
|
Back to top |
|
 |
JosephGramig |
Posted: Fri May 22, 2015 7:08 am Post subject: |
|
|
 Grand Master
Joined: 09 Feb 2006 Posts: 1244 Location: Gold Coast of Florida, USA
|
As it turns out, my colleague Ron M. (not his real name) has a flow actually doing this in the Graphical Data Mapper (GDM) for an MQ message (having nothing what so ever to do with excrementally (since this tool won't let me say what I really mean ) JMS).
On the GDM when you draw a line from the source to the target you get the igmo 'Move' operation. If you click the almost imperseptable tiny blue upside down triangle, you can change that operation to many different things and one of them is 'Convert'. Since "Ron's" flow has been demonstrated to work (although I didn't see it so I don't believe it) I have to believe it work (although I will prove it). |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri May 22, 2015 7:41 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
So did you try convert -> cast-> xs:binary ? _________________ MQ & Broker admin |
|
Back to top |
|
 |
martinb |
Posted: Mon May 25, 2015 1:54 am Post subject: |
|
|
Master
Joined: 09 Nov 2006 Posts: 210 Location: UK
|
Hi
The xs:<type> functions are type casts - so the source operand must be in a format that can be cast to the <type>.
Similarly the built in "Convert" transform is providing a type case between it's source and target element's schema types.
In this case the input is a plain text string, so we can't just cast it, it would first need to be formatted into a string of hex codes representing the original text.
Transforming a string of text characters to a string containing their hex codes can be indeed done XPath. However if Xpath is not your natural instrument of choice to play a fine tune, then the Mapper does allows you to call out to Java or ESQL.
Here's the XPath I've used to format and then cast a text string input, in this case from Mapping input variable "$a" to a hxeBinary
Code: |
xs:hexBinary(string-join(
for $code in string-to-codepoints($a)
return (
substring('0123456789ABCDEF', ($code idiv 16) + 1, 1),
substring('0123456789ABCDEF', ($code mod 16) + 1, 1)
),''))
|
|
|
Back to top |
|
 |
fjb_saper |
Posted: Mon May 25, 2015 4:22 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Not quite trivial as you said. An ESQL cast from chat to BLOB is much easier.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|