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

Class Summary
ConsumerClient  
ProducerClient  
 

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:

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.

  1. Build the example
  2. Configure the server
  3. Run the example

Build the Example

  1. Open a new command shell.

  2. Set up your development shell as described in Setting up your environment.

  3. 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
  4. 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.

Configure the Server

The following procedure shows how to set up a JMS ConnectionFactory and JMS Topic required by the example.
  1. Start the WebLogic Server with the examples configuration in a new command shell.
  2. Invoke the Administration Console in your browser.
  3. Click to expand the Services node in the left pane and expand the JMS node.
  4. Right-click the Connection Factories node and choose Configure a new JMSConnectionFactory from the drop-down list.
  5. Enter messageQueue in the Name field.
  6. Enter examples.soap.msgService.MsgConnectionFactory in the JNDIName field.
  7. Click Create.
  8. Click the Targets tab.
  9. Move examplesServer to the Chosen list box, if not already there.
  10. Click Apply.
  11. Click to expand the Servers node under the JMS node in the left pane.
  12. Click to expand the examplesJMSServer node.
  13. Right-click the Destinations node and choose Configure a new JMSTopic from the drop-down list.
  14. Enter messageQueue in the Name textfield.
  15. Enter examples.soap.msgService.messageQueue in the JNDIName textfield.
  16. Click Create.

Run the Example

  1. Open a separate command-line window in which you will run the Consumer client.
  2. Set up the environment for your client as described in Setting up your environment for building and running the examples.
  3. 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.

  4. Open another command-line window in which you will run the Producer client.
  5. Set up the environment for your client as described in Setting up your environment for building and running the examples.
  6. 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.

  7. 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:


Documentation is available at
http://e-docs.bea.com/wls/docs61

Copyright © 2001 BEA Systems, Inc. All Rights Reserved.