I have XML in the form of text, and I want to convert it into a JMS message object for testing purposes. I can't seem to find the exact method or way to do that.
There are several implementations of javax.jms.Message
. If you are using a String
then the simplest implementation to use would bejava.jms.TextMessage
. You can use the createTextMessage(String)
method on your instance of javax.jms.Session
to create the message containing your XML String
.
Well This is how I got my code to work
TextMessage message = new TextMessageImpl();
message.setText(xmlString);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.