Package examples.webservices.client.static_no_out

This example shows how to use the WebLogic-generated JAX-RPC client Stubs to quickly and easily create a static client application that invokes a non-WebLogic Web service.

See:

 

Class Summary

Main This class demonstrates a java client invoking a WebService.
 

Package examples.webservices.client.static_no_out Description

This example shows how to use the WebLogic-generated JAX-RPC client Stubs to quickly and easily create a static client application that invokes a non-WebLogic Web service. The Web service invoked in the example is a temperature service hosted on the XMethods Web site whose WSDL is publised at the following URL:

http://www.xmethods.net/sd/2001/TemperatureService.wsdl

The build.xml file calls the clientgen Ant task, specifying the WSDL of the Web service with the wsdl attribute. The Ant task creates a directory called websvc which contains the client Stub classes used by the Main.java client program to invoke the Web service.

  Additional Resources for examples.webservices.client.static_no_out

build.xml The Java Ant build script that creates the client Stub classes used to invoke the Temperature Web service on the Xmethods Web site.
Main.java The client application that invokes the Web service.

 

The following sections describe how to build and run the example.

  1. Prerequisites
  2. Build the Example
  3. Run the Example
  4. Check the Output

 

Prerequisites

Before you run this example, you need:

  • WebLogic Server Version 8.1

 

Build the Example

To build the example, follow these steps:
  1. Set up your development shell as described in Quick Start.

  2. Change to the $SAMPLES_HOME\server\examples\src\examples\webservices\client\static_no_out directory, where SAMPLES_HOME refers to the main WebLogic Server examples directory, such as d:\beahome\weblogic81\samples.

  3. Assemble and compile the example by executing the Java ant utility at the command line:
    prompt> ant

 

Run the Example

In your development shell, run the Main Java application using the following command:
prompt> ant run 

NOTE: You do not need to start WebLogic Server because the application invokes a Web service from a different vendor rather than one running on WebLogic Server.

 

Check the Output

If the example executes successfully, you will see the following message in the command window from which you ran the example:
Buildfile: build.xml

run:
     [java] This example shows how to create a static client application that invokes a non-WebLogic Web service.
     [java] The webservice used was: http://www.xmethods.net/sd/2001/TemperatureService.wsdl
     [java] The temperature in the 94501 zip code is:
     [java] 58.0

BUILD SUCCESSFUL

NOTE: The value of 58.0 is a sample output; because the example is executing a real Web service on the Xmethods Web site, you will see the true current temperature in the 94501 zip code.

 

See Also

Read more about: