Sun Java System Application Server 

Samples Index

The JAX-RPC Simple Sample Application

The JAX-RPC Simple application provides an example of a simple web service based on the Web Services for Java 2 Enterprise Edition (J2EE) version 1.1. The sample application includes a web service named HelloWorld and an application client named HelloClient. The figure below shows an overview of this application.

In the server application, the HelloIF Service Endpoint interface is implemented by the HelloImpl Service Implementation Bean. This interface defines the sayHello() method of the HelloWorld web service. Before the first request, the application creates a service instance, the HelloIFPort port component.

In the client container, the HelloClient application client uses JNDI lookup to access the HelloWorld Service object, gets access to HelloIFPort, and invokes the sayHello() method, which accepts a string parameter and returns a string.

Building, Deploying, and Running the Application

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:

Follow this general procedure:

  1. Build the Application. The build file, build.xml, is in the app_dir directory, specifically, install_dir/samples/webservices/jaxrpc/apps/simple.
  2. Deploy the Application. The EAR file is install_dir/samples/webservices/jaxrpc/apps/simple /jaxrpc-simpleClient.jar.
  3. Run the client application as described below.

Running the Sample Application

  1. Change your working directory to app_dir
  2. Run the application client with the command install_dir/bin/appclient -client jaxrpc-simpleClient.jar.

The program uses the retrieved client stubs to display the following:

Hello Duke!

Troubleshooting

When you run the client, if you see the error Connection refused, make certain that the soap:address setting in app_dir/simple-war/src/conf/HelloWorld.wsdl is set to http://hostname:instance-port/jaxrpc-simple/simple.

If you need to modify the file, execute asant core before running the sample again.


Copyright © 2006 Sun Microsystems, Inc. All rights reserved.