![]() |
SOAP to JMS Sample Application |
SOAP to JMS Sample Application
This document describes how to utilize the SOAP to JMS sample application in conjunction with Sun ONE Application Server version 7.This sample application document contains the following sections:
Overview
The SOAP to JMS sample application contains 2 simple standalone java programs, SendSOAPMessageWithJMS and ReceiveSOAPMessageWithJMS.
SendSOAPMessageWithJMS constructs a SOAP message with java.xml.soap API, converts it to a JMS message, and then uses JMS to publish the message to a JMS Topic Destination.
ReceiveSOAPMessageWithJMS uses JMS to subscribes to a JMS Topic, retrieves a JMS-wrapped SOAP message, then converts the message to a SOAP message.
Compiling and Assembling the Application
This section contains instructions to build and assemble the SOAP to JMS sample application using a Command Line Interface (CLI).
Go to the src directory of the sample. For example:
Compile and assemble the application. For example:
- cd <AS_HOME>/samples/jms/soaptojms/simple/src
- <AS_HOME>/bin/asant
The default target core will be executed to compile the java files and rebuild the jar file.
Clean the web application project area using the asant clean command (optional). For example:
Generate javadocs (optional). For example:
- <AS_HOME>/bin/asant clean
After javadocs have been generated, you may access them at <AS_HOME>/samples/jms/soaptojms/simple/javadocs
- <AS_HOME>/bin/asant javadocs
Note <AS_HOME> is Sun ONE application server installation home.
Running the Sample Application
To run the sample application using asant target, do the following:
Go to the src directory of the sample. For example:
Run the ReceiveSOAPMessageWithJMS program in a command window as follows:
- cd <AS_HOME>/samples/jms/soaptojms/simple/src
Wait until you see the message "ready to receive SOAP messages ..." displaying in the first window, then in another command window, run the SendSOAPMessageWithJMS program as follows:
- <AS_HOME>/bin/asant subscribe-message
- <AS_HOME>/bin/asant publish-message
- The SendSOAPMessageWithJMS program should print the following messages:
- [java] Create a SOAP message
- [java] Attach a URL to the message
- [java] Convert the message to a JMS message
- [java] Publish the message
- [java] Finished
- As soon as the SendSOAPMessageWithJMS program finished publishing the message, the ReceiveSOAPMessageWithJMS program in the first command window will display the following messages followed by the html content of the attached URL:
- [java] Message received! Converting the JMS message to SOAP message
- [java] Attachment counts: 1
- [java] Content type: text/html
- [java] Content Id: cid-001
- [java] Attachment content:
- Exit the ReceiveSOAPMessageWithJMS program by typing CTR-C.
Note <AS_HOME> is Sun ONE application server installationation home.
Alternatively, you can run the SendSOAPMessageWithJMS and the ReceiveSOAPMessageWithJMS programs via the provided scripts under <AS_HOME>/samples/jms/soaptojms/simple/src/scripts directory. There are two Shell scripts, subscribe-message.csh and publish-message.csh , to run on Solaris environment and two bat scripts, subscribe-message.bat and publish-message.bat , for Windows environment. To run the programs, do the following:
Go to the scripts directory. For example:
- cd <AS_HOME>/samples/jms/soaptojms/simple/src/scripts
On Solaris, change the permission to make the scripts executable
- chmod 755 publish-message.csh subscribe-message.csh
Type the script name at a command window. The output should be similar to those described above.
If you get Permission denied error message when running the publish-message and subscribe-message scripts in the scripts directory, change the permission to make the scripts executable.
For example, on Solaris execute the command:
- chmod 755 publish-message.csh subscribe-message.csh
If you are unable to run the publish-message and subscribe-message scripts in the scripts directory, make sure that you have the environment variable AS_HOME set to where the Sun ONE Application Server is installed.
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.
Last Updated July 31, 2002