| Sun Java System Application Server |
The SOAP to JMS sample application contains one application client which can be used to invoke two simple Java objects:
SendSOAPMessageWithJMS
constructs a SOAP message using the Soap with Attachments API for Java
(SAAJ) API, converts it to a JMS message,
and then uses JMS to publish the message to a JMS Topic destination. ReceiveSOAPMessageWithJMS
uses JMS to subscribe to a JMS Topic, retrieves a JMS-wrapped SOAP
message, then converts the message to a SOAP message. The general instructions for building, deploying, and running sample applications are provided in Building, Deploying, and Running Sample Applications. In reading this document, use the following application-specific variables for this application:
install_dir is the directory where Application Server is installed.
app_dir is the application base directory:
install_dir/samples/jms/apps/soaptojms/simple.
app_dir/simple-client/SOAPtoJMSMessageSampleClient.jar.
Follow this general procedure:
build.xml, is in the app_dir directory.
By default, the application creates an attachment that includes
the index.html file located at the URL http://localhost:8080/.
If you want to attach a file at a different URL, or if you have changed the Application
Server HTTP port from 8080 to some other value, change the
value of the url property in the src/soaptojms.properties file.
Before you deploy or run the application, you must ensure that the neccessary resources have been configured for
Application Server. The included asant deployment script automatically performs this step for you.
But if you are using another deployment mechanism, you must perform it manually.
See the instructions in Configuring Resources.
If you deploy the application using asant, it will configure all the resources
automatically. Otherwise, you must do it manually.
Follow these steps to configure resources with Admin Console:
JNDI-Name: jms/TopicConnectionFactory Type: javax.jms.TopicConnectionFactory Resource: Select Enabled checkbox
JNDI-Name: jms/TestTopic Type: javax.jms.Topic Resource: Select Enabled checkbox
Name=TestTopic.
To configure the resources using asadmin, use these commands:
Configure connection factory::
asadmin create-jms-resource --user username --password password --restype javax.jms.TopicConnectionFactory jms/TopicConnectionFactory
Configure destination(topic):
asadmin create-jms-resource --user username --password password --restype javax.jms.Topic --property Name=TestTopic jms/TestTopic
To run the sample application follow these steps:
app_dir
cd install_dir/samples/jms/apps/soaptojms/simple/
install_dir/imq/lib/imqxm.jar.
ReceiveSOAPMessageWithJMS object:
install_dir/bin/appclient -client SOAPtoJMSMessageSampleClient.jar Receive
install_dir/imq/lib/imqxm.jar
SendSOAPMessageWithJMS object as follows:
install_dir/bin/appclient -client SOAPtoJMSMessageSampleClient.jar SendIt displays the following messages:
[java] Create a SOAP message
[java] Attaching the file from URL: http://localhost:8080
[java] Convert the message to a JMS message
[java] Publish the message
[java] Finished
When SendSOAPMessageWithJMS finishes publishing the message,
ReceiveSOAPMessageWithJMS in the first command window displays 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:
You can optionally pass in the name of the Topic that you want
the application client to reference when running. This optional paramater must
match the value set to property queue.jndi.name, which is
located in <install_dir>/samples/jms/apps/soaptojms/simple/build.xml file.
The value is set to jms/TestTopic by default. If you choose to pass in this
optional parameter, then you need to pass the Topic name to the appclient command, so that
the application client runs using the correct Topic name. Both the Send and Receive invocations
of the application client must use the same Topic name, and it must match
the queue.jndi.name property value, which again is located in
install_dir/samples/jms/apps/soaptojms/simple/build.xml file.
For example, to run this example in the samples domain, using Topic
name jms/TestTopic, use these commands:
install_dir>/bin/appclient -client SOAPtoJMSMessageSampleClient.jar Receive jms/TestTopic -xml install_dir>/domains/samples/config/sun-acc.xml . install_dir/bin/appclient -client SOAPtoJMSMessageSampleClient.jar Send jms/TestTopic -xml install_dir>/domains/samples/config/sun-acc.xml .
If you run the application in a different domain than the default,
domain1, then you need to pass in the location of sun-acc.xml to the appclient
command, so that the application
client runs using the correct port for that particular domain.
Use the -xml flag to pass in this location of this sun-acc.xml file.
For example, to run this example in the samples domain, use these commands:
install_dir/bin/appclient -client SOAPtoJMSMessageSampleClient.jar Receive -xml install_dir/domains/samples/config/sun-acc.xml install_dir/bin/appclient -client SOAPtoJMSMessageSampleClient.jar Send -xml install_dir/domains/samples/config/sun-acc.xml
Copyright © 2006 Sun Microsystems, Inc. All rights reserved.