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 » messagge broker toolkit - XML TO BLOB - BLOB TO XML

Post new topic  Reply to topic
 messagge broker toolkit - XML TO BLOB - BLOB TO XML « View previous topic :: View next topic » 
Author Message
machine
PostPosted: Thu Mar 30, 2006 9:06 am    Post subject: messagge broker toolkit - XML TO BLOB - BLOB TO XML Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Thu Mar 30, 2006 9:17 am    Post subject: Reply with quote

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
View user's profile Send private message
machine
PostPosted: Thu Mar 30, 2006 9:38 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Thu Mar 30, 2006 10:07 am    Post subject: Reply with quote

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
View user's profile Send private message
srikanth av
PostPosted: Thu Mar 30, 2006 11:03 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Mar 30, 2006 11:19 am    Post subject: Reply with quote

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
View user's profile Send private message
machine
PostPosted: Thu Mar 30, 2006 12:32 pm    Post subject: Reply with quote

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
View user's profile Send private message
machine
PostPosted: Thu Mar 30, 2006 12:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Thu Mar 30, 2006 12:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
machine
PostPosted: Fri Mar 31, 2006 6:17 am    Post subject: Reply with quote

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
View user's profile Send private message
Paul D
PostPosted: Tue Oct 17, 2006 8:18 am    Post subject: Reply with quote

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

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » messagge broker toolkit - XML TO BLOB - BLOB TO XML
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.