Home > OS >  Want to convert an XML String into a JMS message object
Want to convert an XML String into a JMS message object

Time:04-13

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.

CodePudding user response:

There are several implementations of javax.jms.Message. If you are using a String then the simplest implementation to use would be java.jms.TextMessage. You can use the createTextMessage(String) method on your instance of javax.jms.Session to create the message containing your XML String.

CodePudding user response:

Well This is how I got my code to work

TextMessage message = new TextMessageImpl();
message.setText(xmlString);
  • Related