Post a reply

Write your message and submit

Options

Click in the dark area of the image to send your post.

Go back

Topic review (newest first)

yansolo82
2009-06-04 12:11:45

Not very clean but it works !!

Code:

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();
            }

        }

    }
}
shong
2009-06-04 12:03:15

Hello

Just have to get the hex value of that strange string

Please take an example to share your clue.smile

Best regards

          shong

yansolo82
2009-06-04 11:59:55

I found the clue

Just have to get the hex value of that strange string to have the full id

Thanks.

shong
2009-06-04 11:07:04

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

yansolo82
2009-06-04 10:58:57

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....

shong
2009-06-04 08:03:06

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

Code:

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

yansolo82
2009-06-03 17:43:48

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

Board footer

Powered by FluxBB