Author |
Message
|
srinath |
Posted: Sun Apr 22, 2007 9:25 pm Post subject: java program to create an xml MBMessage |
|
|
Novice
Joined: 08 Mar 2007 Posts: 10
|
can any one help how to create an xml mbmesssage using java language.
o/p should be like:
<routing>
<inputprotocol>ghfjh</inputprotocol>
<outputprotocol>dsfdfd</outputprotocol>
</routing> |
|
Back to top |
|
 |
Vitor |
Posted: Mon Apr 23, 2007 1:04 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Have you tried writing Java code within a Java Compute Node? That tends to work fairly well......
Assuming you've tried this, what happened? Presumably it failed (hence your post) but failed how? Error code? Unexpected results?
We'll need a few details here if we're going to avoid just pointing you at the docs.... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
littlechild |
Posted: Wed Apr 25, 2007 6:33 am Post subject: |
|
|
Novice
Joined: 22 Apr 2007 Posts: 17
|
Actually, you can do this thing in java by calling MB java API in JCN and also by MbXPath API in JCN only. You can get good material on both in MB help.MbXPath API is much faster then JAVA API.  |
|
Back to top |
|
 |
mrgate |
Posted: Wed Apr 25, 2007 6:37 am Post subject: Re: java program to create an xml MBMessage |
|
|
 Centurion
Joined: 28 Feb 2007 Posts: 141 Location: India
|
srinath wrote: |
can any one help how to create an xml mbmesssage using java language.
o/p should be like:
<routing>
<inputprotocol>ghfjh</inputprotocol>
<outputprotocol>dsfdfd</outputprotocol>
</routing> |
Hi you can do this.
first specify yours input and I will send you the code. but JavaCompute node accepts message in the format of xml only. |
|
Back to top |
|
 |
Amit_Arora |
Posted: Tue May 22, 2007 6:03 am Post subject: java program to create an xml MBMessage |
|
|
Newbie
Joined: 28 Oct 2005 Posts: 3
|
Hi Rock
I am trying to read the XML files form a dir using JCN and writing to queue. However I m able to read the files and able to fetch the data , but when propgating to the ouput terminal i am not getting any data.
Any thoughts?
Regards,
Amit |
|
Back to top |
|
 |
jbanoop |
Posted: Tue May 22, 2007 9:49 am Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
ok if you just need to dump the XML file content as a message on to a queue, reading the file and setting the read bytes to be the BLOB payload should do the trick.
Are you getting any errors ? what is the code you have written ?
Anoop |
|
Back to top |
|
 |
marcin.kasinski |
Posted: Tue May 22, 2007 11:50 am Post subject: Re: java program to create an xml MBMessage |
|
|
Sentinel
Joined: 21 Dec 2004 Posts: 850 Location: Poland / Warsaw
|
|
Back to top |
|
 |
Amit_Arora |
Posted: Tue May 22, 2007 6:58 pm Post subject: |
|
|
Newbie
Joined: 28 Oct 2005 Posts: 3
|
//Create out Root
MbElement outRoot = outMessage.getRootElement();
//MbElement outRoot1 = outRoot.createElementAsLastChild(0);
// create a top level ’parser’ element with parser class name for MQMD
MbElement properties = outRoot.getFirstChild();
MbElement mqmd = outRoot.createElementAsLastChild("MQHMD");
//create MQMD Header attributes
MbElement format= mqmd.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "Format", "MQSTR");
if (inputFiles != null)
{
int length = inputFiles.length;
for (int i = 0; i < length; i++) {
byte[] data = getFileData(inputFiles[i]);
MbElement msgBody = outRoot.createElementAsLastChildFromBitstream(data,"XML", "", "", "", 0,0, 0);
out.propagate(outAssembly);
outMessage.clearMessage();
//System.out.println("Succesful Putting the data");
//Thread.sleep(1000L);
filesProcessed = filesProcessed + 1;
} |
|
Back to top |
|
 |
|