How Do I: Exchange Messages with a JMS Queue or Topic from a Web Service?

WebLogic Workshop provides the JMS control to enable convenient access to an existing Java Message Service (JMS) queue or topic from web services.

To Create a JMS Control

1. In Design View, find the web service from which you would like to access a JMS queue or topic.

2. From the associated Add Control drop-down list, select Add JMS Control. The Add JMS Control dialog appears.

3. In step 1, enter a name that your web service will use to reference the control member. It is customary for this name to start with a lower-case character. The name you enter must be a valid Java identifier.

4. Select Create a new JMS control to use with this service.

5. In the New CTRL name field, enter a name for the CTRL file. It is customary for this name to start with an upper-case character. The name you enter must be a valid Java identifier.

6. In the first part of step 3 in the dialog, select Queue or Topic.

7. If this JMS control will allow web services to send or publish messages, in the next part of step 3 corresponding to the send-jndi-name box, click browse to select the JNDI name for the queue or topic you will be sending to.

Java Naming and Directory Interface (JNDI) is a registry for resources such as Enterprise Java Beans, JMS queues, and so on. The provider of the resource is responsible for registering it and advertising the name to people or code who need the resource.

7. If this JMS control will allow web services to receive or subscribe to messages, in the next part of the step 3 corresponding to the receive-jndi-name box, enter the JNDI name for the queue or topic you will be receiving from or subscribing to, or click Browse to select one.

8. In the connection factory box, enter the connection factory that you will be using to connect to the queue or topic, or click Browse to select one.

9. Click Create.

A CTRL file is created in the same directory as the web service to which it was being added, and a reference to that control is added to your web service. This control can now be used to access the specified JMS queue or topic. This CTRL file can also be used by other web services.

Related Topics

JMS Control: Using Java Message Service Queues and Topics from Your Web Service