Consultor Eletrônico



Kbase 20458: SonicMQ Example Using the Parse Method of XMLdomMessageImpl
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   28/12/2000
SUMMARY:

This solution provides a small code example tested with a modification of the XMLChat example that comes as source with SonicMQ to read the XML document from an file instead and publish it as XML message.

EXPLANATION:

Within the following code example, the variable with the name "s" is a string object that represents the name of the XML file, for example, java.xml, session is a javax.jms.TopicSession and publisher is a javax.jms.TopicPublisher object:

FileInputStream fis = new FileInputStream(s);
progress.message.jclient.XMLdomMessageImpl xmlimpl =
new progress.message.jclient.XMLdomMessageImpl();
xmlimpl.parse(fis);
org.w3c.dom.Document doc = xmlimpl.getDocument();
fis.close();
progress.message.jclient.XMLMessage xMsg =
((progress.message.jclient.Session)
session).createXMLMessage();
xMsg.setDocument(doc);
publisher.publish( xMsg );

Reference To Written Documentation:

SonicMQ API Reference.