Sun Java System Application Server 

Samples Index

The JAX-RPC simplebean Sample Application

This sample application provides an example of a Web Service for Java Enterprise Edition (J2EE). This sample is similar to the JAX-RPC Simple sample application, except the client invokes methods with arguments of non-primitive types.

Overview

The J2EE application client HelloClient makes a remote call to the demoArray() method of the HelloWorld web service. The web service takes String Array as input and returns reversed String Array. The HelloClient also makes a remote call to the demoBean() method of the HelloWorld web service. The web service takes the SimpleAccountBean object as input, and returns the new BigDecimal account balance by calculating interest.

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/simplebean.
  2. Deploy the Application. The EAR file is install_dir/samples/webservices/jaxrpc/apps/simplebean/jaxrpc-simplebean.ear.
  3. Run the Application as described below.

Running the Sample Application

To run the application, follow these steps:

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

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

demoArray method:
it was a dark and stormy night
night stormy and dark a was it

demoBean method:
SimpleAccountBean: setting balance to 1200.00
SimpleAccountBean: setting customerName to Duke
newBalance: 1260.0000
SimpleAccountBean: setting balance to 1260.0000

Troubleshooting

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

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


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