You are not logged in.
Announcement
Unanswered posts
|
Not very clean but it works !!
package routines;
import java.io.FileOutputStream;
import java.io.IOException;
public class createXMLFile {
public static void copyXML(String messageId, String message) {
String mId ="";
for (int i=0; i<messageId.length(); i++){
String temp = Integer.toHexString((int)messageId.charAt(i)).toString();
if (temp.length()== 1)
mId+="0"+temp;
else
mId+=temp;
}
byte[] b = new byte[message.length()];
b = message.getBytes();
FileOutputStream fos = null;
try {
fos = new FileOutputStream("d:/" + mId + ".xml"); // d:/ is the dir path.
fos.write(b);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}Hello
Just have to get the hex value of that strange string
Please take an example to share your clue.![]()
Best regards
shong
I found the clue
Just have to get the hex value of that strange string to have the full id
Thanks.
Hello
The messageid I get is a strange string which is completely different from the big integer I found when I'm browsing the queue with Hermes Jms....
Yes, I see the messageid is a strange string by default, so we can cut the messageid with one length, eg:
input_row.messageid.substring(0,2)
Best regards
shong
Thanks for your quick reply.
It doesn't work.
The messageid I get is a strange string which is completely different from the big integer I found when I'm browsing the queue with Hermes Jms....
Hello
You need to create a routine to convert message to xml file. Here is a scenario,
1) Go to Repository-->Code-->Routines, and right click on Routines, create a new routine called: createXMLFile
package routines;
import java.io.FileOutputStream;
import java.io.IOException;
public class createXMLFile {
public static void copyXML(String messageId, String message) {
byte[] b = new byte[message.length()];
b = message.getBytes();
FileOutputStream fos = null;
try {
fos = new FileOutputStream("d:/" + messageId + ".xml"); // d:/ is the dir path.
fos.write(b);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
fos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}2) Call the routine on tJavaRow component, as my screenshows.
Best regards
shong
hi,
I'm trying to iterate on each xml message I have in my queue (WMQ)
the aim is to make a copy of the xml file
the filename should be the jmsmessageid
I don't know how to do
Thx