WebLogic XML APIs Using a String Representation Using a DOM Representation

Managing Your Applications 6-31 Send a message to subscribers Fred and Wilma, where publisherSession is a JMS TopicSession. Subscribers with message selector expressions Wilma IS NOT NULL or Fred IS NOT NULL will receive this message. TopicPublisher topicPublisher = publisherSession.createPublisher Topiccontext.lookupIMTopic; TextMessage msg = publisherSession.createTextMessageHi there; msg.setBooleanPropertyFred, true; msg.setBooleanPropertyWilma, true; topicPublisher.publishmsg;

6.10 Sending XML Messages

The WebLogic Server JMS API provides native support for the Document Object Model DOM to send XML messages. The following sections provide information on WebLogic JMS API extensions that provide enhanced support for XML messages. ■ Section 6.10.1, WebLogic XML APIs ■ Section 6.10.2, Using a String Representation ■ Section 6.10.3, Using a DOM Representation

6.10.1 WebLogic XML APIs

You can use the following WebLogic XML APIs for transformation of XML between String and DOM representations: ■ XMLMessage – Use to send messages with XML content. ■ WLSession.createXMLMessage – Use to create an XML message. It is possible for the payload of XMLMessage to be set using one XML representation and retrieved using a different representation. For example, it is valid for the Notes: The optimized message selector and message syntax is based on the standard JMS API; therefore, applications that use this syntax will also work on versions of WebLogic JMS that do not have optimized message selectors, as well as on non-WebLogic JMS products. However, these versions will not perform as well as versions that include this enhancement. The message selector optimization will have no effect on applications that use the MULTICAST_NO_ACKNOWLEDGE acknowledge mode. These applications have no need no need for the enhancement anyway, since the message selection occurs on the client side rather than the server side. Note: This release does not support streaming. Only text and DOM representations of XML documents are supported. 6-32 Programming JMS for Oracle WebLogic Server XMLMessage body to be set using a String representation and be retrieved using a DOM representation.

6.10.2 Using a String Representation

Use the following steps to publish an XML message using a string type: 1. Serialize the XML to a StringWriter. 2. Call toString on the StringWriter and pass it into message.setText. 3. Publish the message.

6.10.3 Using a DOM Representation

Sending XML messages using a DOM representation provides a significant performance improvement over sending messages as a String. Use the following steps to publish an XML message using a Dom Representation: 1. If necessary, generate a DOM document from your XML source. 2. Pass the DOM document into XMLMessage.setDocument. 3. Publish the message. 7 Using JMS Module Helper to Manage Applications 7-1 7 Using JMS Module Helper to Manage Applications The weblogic.jms.extensions.JMSModuleHelper class contains APIs that you can use to programmatically create and manage JMS servers, Store-and-Forward Agents, and JMS system resources. ■ Section 7.1, Configuring JMS System Resources Using JMSModuleHelper