Sun Java System logo
JAX-RPC Dynamic Proxy Sample Application

 

JAX-RPC Dynamic Proxy Sample Application
 

This document describes how to utilize the JAX-RPC sample application in conjunction with Sun Java (tm) System Application Server 7.

This sample application document contains the following sections:

Overview

This examples shows you how to call a remote procedure through a dynamic proxy, a class that is created during runtime. Before creating the proxy class, the client gets information about the service by looking up its WSDL document.

If you want to experiment with a simple JAX-RPC application, see the JAX-RPC simple application.

For more information on the JAX-RPC and JAX-RPC dynamic proxy application, go to java.sun.com/webservices/docs/1.0/tutorial/doc/JAXRPC5.html.

You can find the source code for the sample application under <install_dir>/samples/webservices/jaxrpc/dynamic/src/samples/webservices/jaxrpc/proxy .
 
 

Compiling and Assembling the Application



To recompile, assemble, and deploy the application, see the Sample Application Build Facility document for details on using a build facility to quickly perform these tasks.

For example, to rebuild the entire application from scratch, perform the following steps:

  1. Compile and Assemble the J2EE Application.
  2. Execute the asant command under <install_dir>/samples/webservices/jaxrpc/proxy/src
    The default target core is executed to rebuild the .jar and .war files.
  3. Deploy the Application.
  4. After you have re-created the sample application from scratch, proceed to Deploying the Sample Application.
  5. Clean the application project area.
  6. Execute the asant clean command to clean the application area.
  7. Undeploy the Application.
  8. Execute the asant undeploy command to undeploy the application.
  9. Build Javadocs.
  10. Execute the asant javadocs command to create javadocs.
    The Javadocs are created under <install_dir>/samples/webservices/jaxrpc/proxy/javadocs.
Deploying the Sample Application

In this section, you will learn how to deploy the JAX-RPC sample application.

A pre-built jaxrpc-proxy.war file is supplied with the application server installation. The pre-built jaxrpc-proxy.war file is the Web Archive (.war) file of the application.

Within the .war file resides the XML deployment descriptor files, application class files, and other content required by the application. You can use the pre-built .war file to deploy the application. If you want to experience compiling and assembling the application from scratch, follow instructions under Compiling and Assembling the Application.

To deploy the application, do the following

  1. Ensure that the application administrative server is running.
  2. To start the administrative server, select one of the following commands, depending on your operating system:
    • For UNIX, execute <install_dir>/domains/domain1/admin-server/startserv

    • For Windows, run
    • Start->Programs->Sun Java (tm) System Application Server 7->Start Application Server
  3. Select one of the following approaches to deploying the application:

  4. Command Line-based Deployment describes how to manually register the application in Sun Java (tm) System Application Server using a Command Line Interface (CLI). This is the fastest means of deploying the sample application.

  5. Web-based Deployment describes how to use the web-based Sun Java (tm) System Application Server Deployment Tool to import and deploy the sample application.
Command Line-based Deployment

While Command Line Interface is the quickest means of deploying the application, if you want to experience deploying through a GUI tool, follow the instructions under the Web-based Deployment section.

CLI deployment of the application can be performed using either Using the asant script or Using the asadmin script. The deployment process includes deploying the application .war file to the Sun Java (tm) System application server.
 

Using the asant script

  1. Go to the src directory of the sample. For example:
  2. cd <install_dir>/samples/webservices/jaxrpc/proxy/src
  3. Run asant using deploy task. For example:
  4. asant deploy
    This is an an interactive command that may prompt you to provide the admin-server host, admin-server port, admin user name, admin password, and appserv instance.

     
Using the asadmin script
  1. Go to the proxy directory of the sample. For example:
  2. cd <install_dir>/samples/webservices/jaxrpc/proxy

     
  3. Execute the following command:
  4. asadmin deploy -u <user-name> -w <password> -H <hostname> -p <admin server port> --instance <instance name> jaxrpc-proxy.war .

     
  5. Copy the ProxyHelloWorld.wsdl from <install_dir>/samples/webservices/jaxrpc/proxy/src directory to your instance's docroot directory, for example: <install_dir>/domains/domain1/server1/docroot

  6.  
The deployment process involves the following operations:
  • Copies the ProxyHelloWorld.wsdl from src directory to your instances docroot directory

  • Authenticates against the local application server's administrative server

  • The .war file is transferred to the administrative server

  • The administrative server begins the registration process:
    • Parses the .war file

    • Explodes the bits into repository

    • Registers the J2EE application "jaxrpc-proxy" by updating server.xml
You may now proceed to Running the Sample Application.
 

Web-based Deployment

The following steps explain the web-based deployment process.

  1. Log in to the web-based administration tool from the browser

  2. Navigate as follows:
  3. Application Server Instances --> <server instance> --> Applications --> Web Apps
  4. Click Deploy.

  5. Click Browse to locate the jaxrpc-dynamic.war file.
  6. The file is located under <install_dir>/samples/webservices/jaxrpc/proxy/.
  7. Click OK.

  8. Enter jaxrpc-proxy in the App Name field.

  9. Click OK.
  10. Click the jaxrpc-proxy link to verify that the application is deployed.
  11. Copy the ProxyHelloWorld.wsdl from <install_dir>/samples/webservices/jaxrpc/proxy/src directory to your instance's docroot directory, for example: <install_dir>/domains/domain1/server1/docroot.
  12. Now you are ready to run the application. You may proceed to Running the Sample Application.

     
Running the Sample Application

The URL connection factories do not require any resources to be created in server.xml. The application is run by running the client class, which invokes the Ejb.

To run the JAX-RPC sample application, do the following:

  1. cd <install_dir>/samples/webservices/jaxrpc/proxy/src

  2. Execute the asant run command.
  3. The program should display the following line:
    A dynamic proxy hello to Buzz!
Troubleshooting

If you see a Connection refused error, when you do asant run, make certain that admin.host and sunone.instance.port in <install_dir>/samples/common.properties are correct.


 

 

Copyright © 2002 Sun Microsystems, Inc. All rights reserved.
Last Updated July 23, 2002