ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Mapping node : JSON to XML transformation.

Post new topic  Reply to topic
 Mapping node : JSON to XML transformation. « View previous topic :: View next topic » 
Author Message
Cogito-Ergo-Sum
PostPosted: Mon Nov 12, 2012 4:04 am    Post subject: Mapping node : JSON to XML transformation. Reply with quote

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
View user's profile Send private message
kimbert
PostPosted: Tue Nov 13, 2012 2:08 am    Post subject: Reply with quote

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
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Tue Nov 13, 2012 2:35 am    Post subject: Reply with quote

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
View user's profile Send private message
kimbert
PostPosted: Tue Nov 13, 2012 2:51 am    Post subject: Reply with quote

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
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Tue Nov 13, 2012 3:00 am    Post subject: Reply with quote

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
View user's profile Send private message
kimbert
PostPosted: Tue Nov 13, 2012 3:03 am    Post subject: Reply with quote

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
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Tue Nov 13, 2012 3:09 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Tue Nov 13, 2012 4:30 am    Post subject: Reply with quote

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
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Mon Nov 19, 2012 4:54 am    Post subject: Reply with quote

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
View user's profile Send private message
Cogito-Ergo-Sum
PostPosted: Mon Nov 19, 2012 4:56 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Mapping node : JSON to XML transformation.
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.