|
|
| WebLogic Server 6.1 Code Examples, BEA Systems, Inc. |
Package examples.webservices.message
This example illustrates how to create two message-style WebLogic Web services:
one to send data from a client to WebLogic Server and another to receive the
same data from WebLogic Server.
See:
Description
Package examples.webservices.message Description
This example illustrates how to create two message-style WebLogic Web services:
one to send data from a client to WebLogic Server and another to receive the
same data from WebLogic Server.
The example demonstrates how to:
- Create a message-style Web service that sends data to WebLogic Server.
- Create a message-style Web service that receives data from WebLogic
Server.
- Create a JMS topic that the first message-style Web service sends
messages to and from which the second Web service receives messages from.
- Create the following two clients to invoke the two message-style Web
services:
- a client to invoke the message-style Web service that sends
data to WebLogic Server. The message that is sent to WebLogic Server
ends up on the JMS topic.
- a client to invoke the message-style Web service that receives
data from WebLogic Server. This client essentially polls the
Server until a message appears on the JMS topic.
|
Additional Resources for examples.webservices.message |
| build.xml |
The Java Ant build script assembles and deploys the message-style Web service and compiles the ProducerClient and ConsumerClient Java applications. |
| ConsumerClient.java |
The Java client application that invokes the Web service that receives
data from WebLogic Server. |
| ProducerClient.java |
The Java client application that invokes the Web service that sends data
to WebLogic Server. |
The following sections describe how to build and run the example.
- Build
the example
- Configure the server
- Run
the example
- Open a new command shell.
- Set up your development shell as described in Setting
up your environment.
- Change to the %WL_HOME%/samples/examples/webservices/message directory,
where WL_HOME refers to the main WebLogic Server installation directory:
$ cd %WL_HOME%\samples\examples\webservices\message
- Assemble and deploy the two message-style Web services by typing ant at the command line:
$ ant
The ant utility uses the build.xml build script, which
assembles the two Web services and places the resulting
.ear files in the deployment directory of the examples server. The
build script also compiles the two Java client applications ConsumerClient and
ProducerClient.
The following procedure shows how to set up a JMS ConnectionFactory and JMS
Topic required by the example.
- Start the WebLogic Server with the examples
configuration in a new command shell.
- Invoke the Administration Console in your browser.
- Click to expand the Services node in the left pane and expand the
JMS node.
- Right-click the Connection Factories node and choose Configure a new
JMSConnectionFactory from the drop-down list.
- Enter messageQueue in the Name field.
- Enter examples.soap.msgService.MsgConnectionFactory in the JNDIName field.
- Click Create.
- Click the Targets tab.
- Move examplesServer to the Chosen list box, if not already there.
- Click Apply.
- Click to expand the Servers node under the JMS node in the left pane.
- Click to expand the examplesJMSServer node.
- Right-click the Destinations node and choose Configure a new JMSTopic from the drop-down list.
- Enter messageQueue in the Name textfield.
- Enter examples.soap.msgService.messageQueue in the JNDIName
textfield.
- Click Create.
Run the Example
- Open a separate command-line window in which you will run the Consumer client.
- Set up the environment for your client as described in Setting up your environment for building and running the examples.
- Run the ConsumerClient Java client using the command:
$ java examples.webservices.message.ConsumerClient http://host:port
where host refers to the computer on which WebLogic Server
is running and port refers to the port number WebLogic Server
is listening to. Specify http://localhost:7001 for WebLogic Server
running on the local computer at the default port.
You will see the SOAP message that this client sends to the WebLogic Web
service. This client runs continuously until there is a message on the
JMS Topic for it to receive.
- Open another command-line window in which you will run the Producer client.
- Set up the environment for your client as described in Setting up your environment for building and running the examples.
- Run the ProducerClient Java client using the command:
$ java examples.webservices.message.ProducerClient http://host:port "Hello World."
where host refers to the computer on which WebLogic Server
is running and port refers to the port number WebLogic Server
is listening to. Specify http://localhost:7001 for WebLogic Server
running on the local computer at the default port.
- Check the first command-line window; you should see the message Hello
World as well as the SOAP message.
There's More...
Read more about:
Copyright © 2001 BEA Systems, Inc. All Rights Reserved.