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 » java program to create an xml MBMessage

Post new topic  Reply to topic
 java program to create an xml MBMessage « View previous topic :: View next topic » 
Author Message
srinath
PostPosted: Sun Apr 22, 2007 9:25 pm    Post subject: java program to create an xml MBMessage Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Mon Apr 23, 2007 1:04 am    Post subject: Reply with quote

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
View user's profile Send private message
littlechild
PostPosted: Wed Apr 25, 2007 6:33 am    Post subject: Reply with quote

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
View user's profile Send private message
mrgate
PostPosted: Wed Apr 25, 2007 6:37 am    Post subject: Re: java program to create an xml MBMessage Reply with quote

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
View user's profile Send private message
Amit_Arora
PostPosted: Tue May 22, 2007 6:03 am    Post subject: java program to create an xml MBMessage Reply with quote

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
View user's profile Send private message Yahoo Messenger
jbanoop
PostPosted: Tue May 22, 2007 9:49 am    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
marcin.kasinski
PostPosted: Tue May 22, 2007 11:50 am    Post subject: Re: java program to create an xml MBMessage Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

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>


Maybe it will help you :

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac30310_.htm

You can also check samples from toolkit..
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
Amit_Arora
PostPosted: Tue May 22, 2007 6:58 pm    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » java program to create an xml MBMessage
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.