A web service that demonstrates use of a JMS control to publish messages to
a JMS topic. AccountSubscribe.jws is a companion to this sample.
Concepts Demonstrated by this Sample
-
Start WebLogic Server in the Workshop domain. You can do this in one
of the following ways:
- Open the SamplesApp application from the Workshop IDE. Select File-->Open-->Application,
then navigate to BEA_HOME\weblogic81\samples\workshop\SamplesApp\SamplesApp.work.
Select Tools-->WebLogic Server-->Start WebLogic Server
to start the server.
-
On Microsoft Windows systems, from the
Start
menu, choose
BEA WebLogic Platform 8.1-->
Examples-->
WebLogic
Workshop Examples-->
Launch Examples Server.
-
On Linux or Solaris systems, run BEA_HOME/weblogic81/samples/domains/workshop/startWebLogic.sh
-
Launch the AccountSubscribe.jws service either by opening it in WebLogic
Workshop and selecting the Start operation or by entering http://localhost:7001/WebServices/jms/AccountSubscribe.jws
in the address bar of your browser. If WebLogic Server is running in the appropriate domain on this machine and you have deployed the SamplesApp sample application, you may click
here to run AccountSubscribe.jws.
-
Navigate to the Test Form tab of Test View, if necessary.
-
Invoke the startListening method. The
AccountSubscribe.jws web service is now listening for messages that are
published to a JMS topic named jms.AccountUpdate.
-
Launch the AccountPublish.jws by entering
http://localhost:7001/WebServices/jms/AccountPublish.jws
in the address bar of your browser (not from the WebLogic Workshop visual
development environment). If WebLogic Server is running in the appropriate domain on this machine and you have deployed the SamplesApp sample application, you may
click
here to run AccountPublish.jws.
-
Navigate to the Test Form tab of Test View, if necessary.
-
Enter a string value for accountID and
numeric value for amount and invoke the deposit method.
At this point a message is published to the jms.AccountUpdate
JMS topic.
-
In the browser that is testing AccountSubscribe.jws, click Refresh.
You can see that the accountUpdateReceived
callback has been sent to the client.
-
Select the accountUpdateReceived log entry to see the
payload of the callback. It should contain the same information you
entered for the deposit method in Step 8.
-
The message containing the account transaction is published to the topic
by the AccountPublishJMSControl.jcx JMS control used by
AccountPublish.jws. The JMS server then sends the message to all active
subscribers.
Since AccountSubscribe.jws is subscribed to the topic
via the AccountSubscribeJMSControl.jcx JMS control, it receives the
message. If you examine the two JCX files, you will see that the
information you entered was encoded in both the message properties and the
message body using the @jc:jms-property
and @jc:jms-header properties of the JMS
controls. When using JMS messaging, the senders and receivers of messages
must agree on the message format at design time.