Web Services Invocation Framework:
Implementing the JMS service

The JMS service is implemented as a message driven bean (MDB). In case you need to learn more about MDBs, you can refer to various guides and tutorials available for free online; I found this excerpt from Richard Monson-Haefel's EJB book useful.

The bean implementation is very simple. It acts as a message listener (the queue is determined by the deployment files). When a message is delivered, it extracts the body (recall that we are using JMSTextMessages to communicate back and forth since we are just exchanging strings). This is presumably a valid zip code, so the bean makes it an integer in an unsafe and intrepid manner. Here is applies some logic to determine whether DSL service is available at this zip code or not. A real-world implementation would invariably refer to some backend database using JDBC or do something similarly smart. Our implementation, being just a sample, returns true for all zip codes < 50000, and false otherwise. The return message is sent to the queue specified in the replyTo field of the request message. Note that the bean must encode the correct JMSCorrelationID in the return message in order for it to be picked up by WSIF. Here is the code for our MDB.

The deploy subdirectory contains the things necessary to deploy this MDB to your favorite application server. Generally to deploy your MDB you will need to compile the code for this sample, then package it into a JAR along with the ejb-jar.xml file. Your application server may need other files, take a look at app server specific instructions under the deploy directory. You will also need to fill in the vendor specific deployment information in the sevice WSDL, instructions for which you will also find under the deploy directory. Here are instructions for setting up in case you use JBoss.