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 » Remove CData and utilise complete XML

Post new topic  Reply to topic
 Remove CData and utilise complete XML « View previous topic :: View next topic » 
Author Message
sumit
PostPosted: Wed Oct 03, 2012 6:05 am    Post subject: Remove CData and utilise complete XML Reply with quote

Partisan

Joined: 19 Jan 2006
Posts: 398

Hi All,

I am receiving a SOAP response message having strcuture-
Quote:
<env>
- <body>
- <![CDATA[<?xml version="1.0" encoding="UTF-8"?>
- <A>
- ]]>
- </body>
</env>

I need to remove the CData and send the message as (so that the final application can use it) -

Quote:
<env>
- <body>
- <A>
- </body>
</env>

For this, I am using ASBITSTREAM and CREATE-
Quote:

DECLARE creationPtr REFERENCE TO OutputRoot.XMLNSC.env.body.DataContent;
declare encode INT InputProperties.Encoding;
DECLARE ccsid INT InputProperties.CodedCharSetId;
DECLARE inputmsg BLOB ASBITSTREAM(InputRoot.XMLNSC.env.body.(XMLNSC.CDataField), encode, ccsid);

CREATE LASTCHILD OF creationPtr DOMAIN('XMLNSC') PARSE(inputmsg, encode, ccsid, '','','',RootBitStream);


But I am getting BIP 2906 error. I also tried to use CREATE as

Quote:
CREATE LASTCHILD OF creationPtr DOMAIN('XMLNSC') PARSE(inputmsg, encode, ccsid);


I searched the forum and the infocenter when I faced the errors but looks like I am still missing something.

OS- Win XP
MB- 7.0.0.1 ( I know I can upgrade, but this doesn't look like cause of the problem)
_________________
Regards
Sumit
Back to top
View user's profile Send private message Yahoo Messenger
lancelotlinc
PostPosted: Wed Oct 03, 2012 6:10 am    Post subject: Re: Remove CData and utilise complete XML Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

sumit wrote:
MB- 7.0.0.1 ( I know I can upgrade, but this doesn't look like cause of the problem)


There are more than 500 bug fixes between 7.0.0.1 and 7.0.0.5. How do you know one of these bug fixes might not affect your outcome?
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
sumit
PostPosted: Wed Oct 03, 2012 6:29 am    Post subject: Reply with quote

Partisan

Joined: 19 Jan 2006
Posts: 398

Looks like http://www.mqseries.net/phpBB2/viewtopic.php?t=59177&highlight=cdata is working for me.

Will update you further on this.
_________________
Regards
Sumit
Back to top
View user's profile Send private message Yahoo Messenger
lancelotlinc
PostPosted: Wed Oct 03, 2012 6:35 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

sumit wrote:
Looks like http://www.mqseries.net/phpBB2/viewtopic.php?t=59177&highlight=cdata is working for me.

Will update you further on this.


Google is a wonderful tool.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
sumit
PostPosted: Wed Oct 03, 2012 7:23 am    Post subject: Reply with quote

Partisan

Joined: 19 Jan 2006
Posts: 398

lancelotlinc wrote:

Google is a wonderful tool.

This time, 'direct' credit doesn't go to google; repeated search on mqseries.net gave me the appropriate result.

To point out, below command from the link worked for me.
Quote:
SET Environment.variable.data = OutputRoot.XMLNSC.GetFormResponse.GetFormResult;


CREATE LASTCHILD OF Environment.Variable.XMLMessage DOMAIN ('XMLNSC') PARSE (Environment.variable.data CCSID 1200);
(I changed the CCSID to 437)

Have to read more about ASBITSTREAM.

While looking for the correct procedure, I referred this http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac67175_.htm and the statement
Quote:
The ASBITSTREAM function
If you code the ASBITSTREAM function with the parser mode option set to RootBitStream to parse a message tree to a bit stream, the result is an XML document that is built from the children of the target element in the normal way.
made me feel that I need to use ASBITSTREAM.
_________________
Regards
Sumit
Back to top
View user's profile Send private message Yahoo Messenger
kimbert
PostPosted: Wed Oct 03, 2012 7:49 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

It's actually even easier than that. I think some explanation of what is going on would help ( and see comment below about user trace ).

- The XMLNSC parser has parsed your input document.
- The content of the CData section is now represented as a CHARACTER field in the message tree. Note that the CData tags have been removed.
- You now want to parse the XML string that is held in the CHARACTER field 'myRef '.

Here's the long way to do it:
Code:
DECLARE xmlAsBLOB CAST myRef AS BLOB CCSID 1208;
CREATE LASTCHILD OF myRef PARSE xmlAsBLOB DOMAIN 'XMLNSC' CCSID 1208;
This is encoding the character data in the message tree as a BLOB using UTF-8, and then asking the parser to parse the BLOB using UTF-8.

But message broker knows that a CHARACTER field needs to be converted to BLOB if you are giving to a parser. So it does that step for you. So this will also work:
Code:
CREATE LASTCHILD OF creationPtr PARSE myRef DOMAIN 'XMLNSC';
[edited to swap the refs, as in the OP's example]

Final comment : user trace is a really good diagnostic tool. It is also a very useful educational tool, because it shows you some of what is happening 'under the hood'.


Last edited by kimbert on Wed Oct 03, 2012 7:58 am; edited 1 time in total
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Oct 03, 2012 7:53 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The thing to remember about ASBITSTREAM is that it's the opposite of CREATE FIELD.. PARSE.

ASBITSTREAM takes a tree and turns it into a blob (... tree AS BITSTREAM... )

Create field takes a bitstream and turns it into a tree.
Back to top
View user's profile Send private message
sumit
PostPosted: Wed Oct 03, 2012 8:20 am    Post subject: Reply with quote

Partisan

Joined: 19 Jan 2006
Posts: 398

Thanks kimbert and mqjeff, it is much clear to me now. As suggested, will use trace node to witness the wonders
_________________
Regards
Sumit
Back to top
View user's profile Send private message Yahoo Messenger
mqjeff
PostPosted: Wed Oct 03, 2012 8:26 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

the suggestion was to use "user trace" which is not "trace node".

User trace is a way of seeing the execution of your flow, including the evaluation of each part of each ESQl statement.

A trace node shows you the value of any part of the logical message tree at a specific point in time.
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 » Remove CData and utilise complete 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.