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 Insert menu, choose Controls-->JMS. The Insert Control - Insert JMS dialog opens.
  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 the Create a new JMS control to use with this service radio button.
  5. In the New JCX name field, enter a name for the JCX 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.
  8. 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.
  9. In the connection factory field, enter the connection factory that you will be using to connect to the queue or topic, or click Browse to select one.
  10. Click Create.

A JCX 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 JCX file can also be used by other web services.

Related Topics

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