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 » How to Decode the Xml value from the Blob filed

Post new topic  Reply to topic Goto page 1, 2  Next
 How to Decode the Xml value from the Blob filed « View previous topic :: View next topic » 
Author Message
Laaziya
PostPosted: Mon Mar 10, 2014 11:41 pm    Post subject: How to Decode the Xml value from the Blob filed Reply with quote

Novice

Joined: 05 Mar 2014
Posts: 13

Hi Everyone,

We have encoded to insert the xml to a Blob field.

DECLARE wholeMsgBlob BLOB ASBITSTREAM(InputRoot.XMLNSC,InputRoot.Properties.Encoding,InputRoot.Properties.CodedCharSetId );

DECLARE wholeMsgChar CHAR CAST(wholeMsgBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId);

SET OutputRoot.XMLNSC.StoreMessage.(XMLNSC.CDataField)InputXML = wholeMsgChar;

Can any one please let me know how to Decode this and get the Xml , so that i can make the updation of values in Xml .
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Mar 11, 2014 1:56 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

OutputRoot.XMLNSC is a message tree, not a string. So you need CREATE...PARSE, not CAST.

Many people have asked this question before, so please search this forum for an example of the code that you need.
_________________
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
View user's profile Send private message
Laaziya
PostPosted: Wed Mar 12, 2014 9:59 pm    Post subject: How to Decode the Xml value from the Blob filed Reply with quote

Novice

Joined: 05 Mar 2014
Posts: 13

I could not get the code. Can you pls let me know What exactly must be done
Back to top
View user's profile Send private message
Laaziya
PostPosted: Wed Mar 12, 2014 10:11 pm    Post subject: How to Decode the Xml value from the Blob filed Reply with quote

Novice

Joined: 05 Mar 2014
Posts: 13

I have tried below one

DECLARE wholeMsgBlob BLOB ASBITSTREAM(InputRoot.XMLNSC,InputRoot.Properties.Encoding,InputRoot.Properties.CodedCharSetId );
DECLARE wholeMsgChar CHAR CAST(wholeMsgBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
CREATE FIELD Environment.Outbound.MetaClaimXml;
DECLARE creationPtr REFERENCE TO Environment.Outbound.MetaClaimXml;
CREATE FIRSTCHILD OF creationPtr DOMAIN('XMLNS') PARSE(wholeMsgBlob,
InputProperties.Encoding,InputProperties.CodedCharSetId);

SET OutputRoot.XMLNSC.StoreMessage.InputXML =creationPtr ;

But it debug gettting terminated .. Pls help us .
Back to top
View user's profile Send private message
Esa
PostPosted: Wed Mar 12, 2014 11:09 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

I regret to say, but kimbert obviously didn't notice that you were trying to create a CData field, so his reply was quite misleading.

Your first approach was in principle correct. I didn't bother trying to figure out why it doesn't work, because normally you do it a bit differently.

This 'works':
Code:
DECLARE wholeMsgBlob BLOB ASBITSTREAM(InputRoot.XMLNSC,InputRoot.Properties.Encoding,InputRoot.Properties.CodedCharSetId );

CREATE FIRSTCHILD OF OutputRoot.XMLNSC.StoreMessage TYPE XMLNSC.CDataField NAME 'InputXML' VALUE CAST(wholeMsgBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId );
Back to top
View user's profile Send private message
Esa
PostPosted: Wed Mar 12, 2014 11:23 pm    Post subject: Re: How to Decode the Xml value from the Blob filed Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

Ah, maybe it was me who did not understand the encrypted question:

Laaziya wrote:

Can any one please let me know how to Decode this and get the Xml , so that i can make the updation of values in Xml .


So, if what you want to do is to move the input message copy from the CData field into XML that you can update, it's even simpler:

Code:
CREATE FIRSTCHILD OF OutputRoot.XMLNSC.StoreMessage.InputXML FROM InputRoot.XMLNSC
Back to top
View user's profile Send private message
Laaziya
PostPosted: Wed Mar 12, 2014 11:38 pm    Post subject: Reply with quote

Novice

Joined: 05 Mar 2014
Posts: 13

Thanks, I will let you know in detail,

We have done below one to encode the values so that it would be inserted in CLOB(datatype)in table. It worked fine and xml got inserted.

DECLARE wholeMsgBlob BLOB ASBITSTREAM(InputRoot.XMLNSC,InputRoot.Properties.Encoding,InputRoot.Properties.CodedCharSetId );

DECLARE wholeMsgChar CHAR CAST(wholeMsgBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId);

SET OutputRoot.XMLNSC.StoreMessage.(XMLNSC.CDataField)InputXML = wholeMsgChar;


Now i need to get tat xml and use it . but since it is encode.

SET Environment.Outbound.Meta= PASSTHRU('SELECT XML_IN FROMTABLE WHERE ID =?',Id);

I get the value in the below manner

OutputRoot
Values :CHARACTER[TEXT ] xmlin <Xml values>

Every time its passing as Xmlin ... not in the message tree format. Can you please help out. So tat i can create the message tree.


Note: Above are the one which i tried. Please let me know if i need to change any thing command.
Back to top
View user's profile Send private message
Laaziya
PostPosted: Wed Mar 12, 2014 11:41 pm    Post subject: Reply with quote

Novice

Joined: 05 Mar 2014
Posts: 13

Or Is there is any other way to insert the XML in CLOB(datatype) in table , So tat we insert directly and fetch the XML to use it...
Back to top
View user's profile Send private message
Esa
PostPosted: Wed Mar 12, 2014 11:47 pm    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

Oh, another flow needs to fetch the message from the database and process it? Then you need to parse it.
Back to top
View user's profile Send private message
Laaziya
PostPosted: Wed Mar 12, 2014 11:51 pm    Post subject: Reply with quote

Novice

Joined: 05 Mar 2014
Posts: 13

Yes u r right. in one flow they are encoding it and inserting in CLOB(Datatype) and inserting it. Another flow we need to fetch ahd reuse it.

Is ter is any way To insert xml to CLOB(datatype) without encoding process. By normal insertion it is passing as null value.
Back to top
View user's profile Send private message
Esa
PostPosted: Thu Mar 13, 2014 12:18 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

Laaziya wrote:
Yes u r right. in one flow they are encoding it and inserting in CLOB(Datatype) and inserting it. Another flow we need to fetch ahd reuse it.

Is ter is any way To insert xml to CLOB(datatype) without encoding process. By normal insertion it is passing as null value.


Yes, if 'normal insertion' is to try to insert the value of a complex XMLNSC Element, the result will be null. Because the value of a complex element is null.

You need to stiffen the stuff by serializing it into a string to make it successfully penetrate the database. Just as you have been doing with the Cdata element.

And in the other flow you need to cast the string that you fetch from the database into BLOB and then parse it into a message tree.
Back to top
View user's profile Send private message
Laaziya
PostPosted: Thu Mar 13, 2014 12:51 am    Post subject: Reply with quote

Novice

Joined: 05 Mar 2014
Posts: 13

I have used the below code..It results with an Error while debugging .

DECLARE wholeMsgBlob BLOB ASBITSTREAM(InputRoot.XMLNSC,InputRoot.Properties.Encoding,InputRoot.Properties.CodedCharSetId );
DECLARE wholeMsgChar CHAR CAST(wholeMsgBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
CREATE FIELD Environment.Outbound.MetaClaimXml;
DECLARE creationPtr REFERENCE TO Environment.Outbound.MetaClaimXml;
CREATE FIRSTCHILD OF creationPtr DOMAIN('XMLNS') PARSE(wholeMsgBlob,
InputProperties.Encoding,InputProperties.CodedCharSetId);

SET OutputRoot.XMLNSC.StoreMessage.InputXML =creationPtr ;
Back to top
View user's profile Send private message
Esa
PostPosted: Thu Mar 13, 2014 1:05 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

The first flow that creates the CDataField that gets inserted in the database is OK. You shouldn't try to change it.

It's the other flow that reads the XML from the database that you need to change.
Back to top
View user's profile Send private message
Laaziya
PostPosted: Thu Mar 13, 2014 1:20 am    Post subject: Reply with quote

Novice

Joined: 05 Mar 2014
Posts: 13

Yes im try to parse the XML from table to XLMNSC using the above code. but it leads error.
Back to top
View user's profile Send private message
Esa
PostPosted: Thu Mar 13, 2014 1:29 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2008
Posts: 1387
Location: Finland

It doesn't look like it. Where is the code where you fetch the field from the database?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to Decode the Xml value from the Blob filed
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.