Author |
Message
|
machine |
Posted: Thu Mar 30, 2006 9:06 am Post subject: messagge broker toolkit - XML TO BLOB - BLOB TO XML |
|
|
Novice
Joined: 30 Mar 2006 Posts: 10
|
I have an XML and I translated it to a BLOB. Now I need to translate it back to XML... is there any way to do it?
thanx |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 30, 2006 9:17 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
What have you tried?
How did you "translate" it to BLOB?
Where have you looked? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
machine |
Posted: Thu Mar 30, 2006 9:38 am Post subject: |
|
|
Novice
Joined: 30 Mar 2006 Posts: 10
|
i have an XML message in a Coumpute node. There is a line in that compute where i convert that message in a blob.
SET OutputRoot.BLOB = BITSTREAM(InputRoot.XML);
Then the message is being sent to an MQOUTPUT
When i retrieve it through an MQINPUT... i want to translate that OutputRoot.BLOB to XML again....
sorry 4 my english!
Salute, cometrabuco. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 30, 2006 10:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
BITSTREAM is bad.
DO NOT USE BITSTREAM.
Use ASBITSTREAM.
When you receive it through MQInput, it is not in OutputRoot.BLOB. It is in InputRoot, under whatever parser you assigned as the Default on the MQInput node or in the MQRFH2. So change your MQInput node to "XML" as the message domain (or "XMNLS" is better).
You do not need to use BITSTREAM or ASBITSTREAM before sending data to the MQOutput node, either. It will do that for you.
Have you had training on Message Broker? It is not an easy product to learn on your own. You should get some training. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
srikanth av |
Posted: Thu Mar 30, 2006 11:03 am Post subject: |
|
|
Apprentice
Joined: 30 Jun 2005 Posts: 37
|
Hi,
You can look at the following code for converting XML to BLOB and again BLOB to XML.
DECLARE bodyBlob BLOB ASBITSTREAM(InputRoot.XML.TestCase.myFolder,
InputProperties.Encoding,
InputProperties.CodedCharSetId,",",",FolderBitStream);
DECLARE creationPtr REFERENCE TO OutputRoot;
CREATE LASTCHILD OF creationPtr DOMAIN('XML') PARSE(bodyBlob,
InputProperties.Encoding,
InputProperties.CodedCharSetId,",",",FolderBitStream); _________________ a v srikanth |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 30, 2006 11:19 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
But most situations do not require that you do this.
In normal situations, an MQInput node will parse data from the message bit stream for you, into a logical message tree. You do need to identify what format the data is in - an RCD node can be used for this or the message can contain an MQRFH2 or the Default properties of the MQInput node can be used.
In normal situations, an MQOutput node will invoke the right parser to transform the logical message tree into the correctly formated message bit stream. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
machine |
Posted: Thu Mar 30, 2006 12:32 pm Post subject: |
|
|
Novice
Joined: 30 Mar 2006 Posts: 10
|
jefflowrey wrote: |
Have you had training on Message Broker? It is not an easy product to learn on your own. You should get some training. |
Yeah... i´m working with this tool since 6 mounths.......... anyway... i should get some real training..... |
|
Back to top |
|
 |
machine |
Posted: Thu Mar 30, 2006 12:39 pm Post subject: |
|
|
Novice
Joined: 30 Mar 2006 Posts: 10
|
srikanth av wrote: |
Hi,
You can look at the following code for converting XML to BLOB and again BLOB to XML.
DECLARE bodyBlob BLOB ASBITSTREAM(InputRoot.XML.TestCase.myFolder,
InputProperties.Encoding,
InputProperties.CodedCharSetId,",",",FolderBitStream);
DECLARE creationPtr REFERENCE TO OutputRoot;
CREATE LASTCHILD OF creationPtr DOMAIN('XML') PARSE(bodyBlob,
InputProperties.Encoding,
InputProperties.CodedCharSetId,",",",FolderBitStream); |
thank u... that´s may work for what i need |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 30, 2006 12:44 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
machine wrote: |
that´s may work for what i need |
What do you really need to do?
As I said, normally setting properties on MQInput nodes are sufficient, and then using RCD nodes or some other to set OutputRoot.Properties before going to the MQOutput node.
If you need to do something like store message data in a database, then you can use ASBITSTREAM as shown.
If you need to extract data from a bitstream inside a flow, then you can use Create Field... PARSE... as shown.
But you should not, within the same flow, use AsBitstream to convert some data into a bitstream and then use Create Field...Parse to extract the SAME data again.... It's wasted effort. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
machine |
Posted: Fri Mar 31, 2006 6:17 am Post subject: |
|
|
Novice
Joined: 30 Mar 2006 Posts: 10
|
jefflowrey wrote: |
machine wrote: |
that´s may work for what i need |
What do you really need to do?
As I said, normally setting properties on MQInput nodes are sufficient, and then using RCD nodes or some other to set OutputRoot.Properties before going to the MQOutput node.
If you need to do something like store message data in a database, then you can use ASBITSTREAM as shown.
If you need to extract data from a bitstream inside a flow, then you can use Create Field... PARSE... as shown.
But you should not, within the same flow, use AsBitstream to convert some data into a bitstream and then use Create Field...Parse to extract the SAME data again.... It's wasted effort. |
3
I need to do this to use Cache nodes. |
|
Back to top |
|
 |
Paul D |
Posted: Tue Oct 17, 2006 8:18 am Post subject: |
|
|
 Master
Joined: 16 May 2001 Posts: 200 Location: Green Bay Packer Country
|
Here's some simple code for grabbing an element from an XML doc, casting it to blob as your outbound payload. this can be sent directly to the MQOutput node like this. No RCD needed. I'm being a bit tricky as to where I pull my value from. I grab from an alement one in on the tree from a variable, you can just code in a specific element.
Code: |
SET OutputRoot.BLOB.BLOB =
CAST(InputBody.(XML.Element)[1].{FIELDVALUE(Environment.Variables.SwitchRecord.ServiceDestination.msgPayloadBodyXML)} AS BLOB
CCSID InputRoot.Properties.CodedCharSetId
ENCODING InputRoot.Properties.Encoding); |
_________________ Thanks!!!
Paul D |
|
Back to top |
|
 |
|