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 » Parsing in JCN

Post new topic  Reply to topic
 Parsing in JCN « View previous topic :: View next topic » 
Author Message
saddankula
PostPosted: Tue Jul 02, 2013 6:43 am    Post subject: Parsing in JCN Reply with quote

Acolyte

Joined: 27 Jun 2013
Posts: 51

Hi WMB Developers,

I have parsed records from xml to BLOB using JCN. When I debug the flow I have seen the message in output structure,but in output queue i got 0length of data.

Here is my code

MbElement rootElement=inMessage.getRootElement().getLastChild().getLastChild();
List<MbElement> li=(List<MbElement>)rootElement.evaluateXPath("*");

MbMessage outMessage = new MbMessage(inMessage);
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin,outMessage);
outMessage.getRootElement().getLastChild().detach();
MbElement blob=outMessage.getRootElement().createElementAsLastChild(MbBLOB.PARSER_NAME);
blob.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,"Records",li.toString().getBytes());
Code:
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jul 02, 2013 6:49 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Review the BLOB parser again.
Back to top
View user's profile Send private message
saddankula
PostPosted: Tue Jul 02, 2013 6:52 am    Post subject: Reply with quote

Acolyte

Joined: 27 Jun 2013
Posts: 51

I am not getting
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jul 02, 2013 6:57 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

saddankula wrote:
I am not getting


You are building the wrong tree. The BLOB parser does not work the way you are trying to use it.

Go learn how the BLOB parser works, and then fix your code to build the right tree.

Go, read, think, try, repeat.
Back to top
View user's profile Send private message
saddankula
PostPosted: Tue Jul 02, 2013 7:02 am    Post subject: Reply with quote

Acolyte

Joined: 27 Jun 2013
Posts: 51

Can any one correct the above code where I did mistake
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Jul 02, 2013 7:08 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

saddankula wrote:
Can any one correct the above code where I did mistake


It's this line
Code:
blob.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,"Records",li.toString().getBytes());


That builds the WRONG TREE.

It will take you FAR less time and be FAR MORE VALUABLE if you simply GO to the Info Center and READ about the BLOB parser.

Why do you refuse to do this?
Back to top
View user's profile Send private message
saddankula
PostPosted: Tue Jul 02, 2013 7:43 am    Post subject: Is this code is correct or not Reply with quote

Acolyte

Joined: 27 Jun 2013
Posts: 51

String myMsg = "The Message Data";
MbElement outRoot = outMessage.getRootElement();
// Create the Broker Blob Parser element
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
// Create the BLOB element in the Blob parser domain with the required text
MbElement outBody = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes());
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jul 02, 2013 10:34 am    Post subject: Re: Is this code is correct or not Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

saddankula wrote:
String myMsg = "The Message Data";
MbElement outRoot = outMessage.getRootElement();
// Create the Broker Blob Parser element
MbElement outParser = outRoot.createElementAsLastChild(MbBLOB.PARSER_NAME);
// Create the BLOB element in the Blob parser domain with the required text
MbElement outBody = outParser.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "BLOB", myMsg.getBytes());

98% there. Think about CCSID and you'll get the next 2 %!
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
premji
PostPosted: Wed Jul 03, 2013 2:05 am    Post subject: Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

How can we set the CCSID for BLOB parser
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jul 03, 2013 2:23 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

premji wrote:
How can we set the CCSID for BLOB parser


With the provided option
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Jul 03, 2013 4:13 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I suggest that you read the JavaDoc for java.lang.String.getBytes().
Back to top
View user's profile Send private message
premji
PostPosted: Wed Jul 03, 2013 4:50 am    Post subject: Reply with quote

Acolyte

Joined: 01 Jul 2013
Posts: 64

This code working properly but I have not get data in the output queue
MbMessage outMessage = new MbMessage(inMessage);
MbMessageAssembly outAssembly = new MbMessageAssembly(contact admin,outMessage);
outMessage.getRootElement().getLastChild().detach();
MbElement blob=outMessage.getRootElement().createElementAsLastChild(MbBLOB.PARSER_NAME);
MbElement bl1=blob.createElementAsLastChild(MbBLOB.ROOT_ELEMENT_NAME);
bl1.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,"Record",fName.getValueAsString().getBytes());
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jul 03, 2013 5:34 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

premji wrote:
bl1.createElementAsLastChild(MbElement.TYPE_NAME_VALUE,"Record",fName.getValueAsString().getBytes());


This line will never produce any output under the BLOB parser.

EVER.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Jul 03, 2013 11:48 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
This code working properly but I have not get data in the output queue
It may be "working properly", but it is not good code. Did you read that JavaDoc?
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 » Parsing in JCN
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.