Author |
Message
|
saddankula |
Posted: Tue Jul 02, 2013 6:43 am Post subject: Parsing in JCN |
|
|
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());
|
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jul 02, 2013 6:49 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Review the BLOB parser again. |
|
Back to top |
|
 |
saddankula |
Posted: Tue Jul 02, 2013 6:52 am Post subject: |
|
|
Acolyte
Joined: 27 Jun 2013 Posts: 51
|
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jul 02, 2013 6:57 am Post subject: |
|
|
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 |
|
 |
saddankula |
Posted: Tue Jul 02, 2013 7:02 am Post subject: |
|
|
Acolyte
Joined: 27 Jun 2013 Posts: 51
|
Can any one correct the above code where I did mistake |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Jul 02, 2013 7:08 am Post subject: |
|
|
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 |
|
 |
saddankula |
Posted: Tue Jul 02, 2013 7:43 am Post subject: Is this code is correct or not |
|
|
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 |
|
 |
fjb_saper |
Posted: Tue Jul 02, 2013 10:34 am Post subject: Re: Is this code is correct or not |
|
|
 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 |
|
 |
premji |
Posted: Wed Jul 03, 2013 2:05 am Post subject: |
|
|
Acolyte
Joined: 01 Jul 2013 Posts: 64
|
How can we set the CCSID for BLOB parser |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 03, 2013 2:23 am Post subject: |
|
|
 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 |
|
 |
kimbert |
Posted: Wed Jul 03, 2013 4:13 am Post subject: |
|
|
 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 |
|
 |
premji |
Posted: Wed Jul 03, 2013 4:50 am Post subject: |
|
|
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 |
|
 |
mqjeff |
Posted: Wed Jul 03, 2013 5:34 am Post subject: |
|
|
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 |
|
 |
kimbert |
Posted: Wed Jul 03, 2013 11:48 am Post subject: |
|
|
 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 |
|
 |
|