|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Mapping node : JSON to XML transformation. |
« View previous topic :: View next topic » |
Author |
Message
|
Cogito-Ergo-Sum |
Posted: Mon Nov 12, 2012 4:04 am Post subject: Mapping node : JSON to XML transformation. |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
How do you transform a JSON message to a XML message using the Mapping node in WMB v8 ?
I have an MQInput node whose parser is set to JSON. I think, I will have to read its parsed output in a Compute node and build the XML document from there. Is this the way ?
It would have been nice to make the Mapping node take the parsed output directly than a message model, etc.
Btw, would you know, if esql: functions could be used ? I had a need to generate an 'identifier' field for which, I thought, I would use the UUIDASCHAR function. I ended up using fn:current-dateTime as fn:random didn't work. _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 13, 2012 2:08 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I have an MQInput node whose parser is set to JSON. I think, I will have to read its parsed output in a Compute node and build the XML document from there. Is this the way ? |
The Mapping node requires an XSD for both sides of the transformation. I assume that you do not have an xsd that describes the JSON input document. So you will need to use something else, and a Compute node is a valid choice.
Quote: |
and build the XML document from there |
I'm being pedantic now, but in WMB you never have to 'build an XML document'. You build a message tree under OutputRoot.XMLNSC and the parser builds the document for you.
Quote: |
It would have been nice to make the Mapping node take the parsed output directly than a message model, etc. |
Hard to argue with that.
Quote: |
Btw, would you know, if esql: functions could be used ? I had a need to generate an 'identifier' field for which, I thought, I would use the UUIDASCHAR function. I ended up using fn:current-dateTime as fn:random didn't work. |
I don't understand the requirement - can you explain a little more clearly? |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Tue Nov 13, 2012 2:35 am Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
Quote: |
I assume that you do not have an xsd that describes the JSON input document. |
No, I don't. I am not sure, I understood the italicized part. I looked for JSON in the infocenter but, couldn't find anything correlating XSD and JSON.
Quote: |
You build a message tree under OutputRoot.XMLNSC and the parser builds the document for you. |
Thanks for pointing out the accurate lingo. I should have used something similar; but, did mean the same though.
Quote: |
I don't understand the requirement - can you explain a little more clearly? |
Simply put, is there a function to assign a UUID value to a target field in Mapping node ?
The final required XML document (as built by the parser from message tree under OutputRoot.XMLNSC) must have an attribute called as identifier. This identifier should be unique over repeated (low frequency) creations of this document. I wanted to use the fn:random function in a Custom XPath transform to achieve this uniqueness; it didn't work. Then, I thought, I could invoke something like esql:uuidaschar (as available in v7) to get the unique identifier; but, I guess, it is not supported either. So, I ended up using fn:current-dateTime which is serving the purpose well. _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 13, 2012 2:51 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Then, I thought, I could invoke something like esql:uuidaschar (as available in v7) to get the unique identifier; but, I guess, it is not supported either. |
I don't see anything in the info center topic that says that explicitly. I don't see any reason why it should not work. What happened when you tried it? |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Tue Nov 13, 2012 3:00 am Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
Quote: |
What happened when you tried it? |
I didn't try as I don't know if I could try what I want to try.
It seems, unlike Custom XPath, where you just mention the function and arguments, Custom ESQL requires a complete ESQL module. So, I do not know, how to invoke an ESQL function similar to XPath function. If the invocation has to be via ESQL modules in a file, well, that is a different story. And, for this particular case, I think, an ESQL module is an overkill; especially, when fn:current-dateTime is sufficient. _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 13, 2012 3:03 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK - that makes more sense. So you're not claiming that you tried it and it failed. And you're not claiming that it is unsupported. You're just saying that you found an easier way to do it. |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Tue Nov 13, 2012 3:09 am Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
Quote: |
And you're not claiming that it is unsupported. |
Well..........I was looking for a v7 feature in v8 and couldn't locate it ... _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Nov 13, 2012 4:30 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Cogito-Ergo-Sum wrote: |
Quote: |
And you're not claiming that it is unsupported. |
Well..........I was looking for a v7 feature in v8 and couldn't locate it ... |
Yeah ,this is the heart of the matter. v8 mapper doesn't support (yes, "support" is the correct word) the same set of esql: functions that v7 mapper does.
They don't exist, and you can't use them.
Cogito-Ergo-Sum is not saying that he or she found an easier way to insert a UUIDASCHAR value. Cogito-Ergo-Sum is saying he or she is using a different value instead of a UUIDASCHAR value.
And you don't actually have to create a whole compute module to use an ESQL function from a v8 map node. you can just create a function or procedure outside of a module.
But it does have to be in an .esql file somewhere... |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Mon Nov 19, 2012 4:54 am Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
mqjeff wrote: |
Yeah ,this is the heart of the matter. v8 mapper doesn't support (yes, "support" is the correct word) the same set of esql: functions that v7 mapper does.
They don't exist, and you can't use them.
Cogito-Ergo-Sum is not saying that he or she found an easier way to insert a UUIDASCHAR value. Cogito-Ergo-Sum is saying he or she is using a different value instead of a UUIDASCHAR value. |
Thanks ! And, Cogito-Ergo-Sum is a he.
The consuming application has come back insisting that I pass UUID for the identifier element. So, I am using the Custom ESQL transform to generate and pass the UUID; it has run into a problem. _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes
Last edited by Cogito-Ergo-Sum on Wed Nov 28, 2012 9:25 pm; edited 1 time in total |
|
Back to top |
|
 |
Cogito-Ergo-Sum |
Posted: Mon Nov 19, 2012 4:56 am Post subject: |
|
|
 Master
Joined: 07 Feb 2006 Posts: 293 Location: Bengaluru, India
|
mqjeff wrote: |
Yeah ,this is the heart of the matter. v8 mapper doesn't support (yes, "support" is the correct word) the same set of esql: functions that v7 mapper does.
They don't exist, and you can't use them.
Cogito-Ergo-Sum is not saying that he or she found an easier way to insert a UUIDASCHAR value. Cogito-Ergo-Sum is saying he or she is using a different value instead of a UUIDASCHAR value. |
Thanks ! And, Cogito-Ergo-Sum is a he.
The consuming application has come back insisting that I pass UUID for the identifier element. So, I am using the Custom ESQL transform to generate and pass the UUID; it has run into a problem _________________ ALL opinions are welcome.
-----------------------------
Debugging tip:When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
---Sherlock Holmes |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|