![]() |
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 ONE Application Server version 7.
This sample application document contains the following sections:
Overview
- Overview
- Compiling and Assembling the Application
- Deploying the Sample Application
- Running the Sample Application
- Troubleshooting
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:
Deploying the Sample Application
- Compile and Assemble the J2EE Application.
- 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.
- Deploy the Application.
- After you have re-created the sample application from scratch, proceed to Deploying the Sample Application.
- Clean the application project area.
- Execute the asant clean command to clean the application area.
- Undeploy the Application.
- Execute the asant undeploy command to undeploy the application.
- Build Javadocs.
- Execute the asant javadocs command to create javadocs.
- The Javadocs are created under <install_dir>/samples/webservices/jaxrpc/proxy/javadocs.
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
Command Line-based Deployment
- Ensure that the application administrative server is running.
- 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 ONE Application Server 7->Start Application Server
- Select one of the following approaches to deploying the application:
- Command Line-based Deployment describes how to manually register the application in Sun ONE Application Server using a Command Line Interface (CLI). This is the fastest means of deploying the sample application.
- Web-based Deployment describes how to use the web-based Sun ONE Application Server Deployment Tool to import and deploy the sample application.
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 ONE application server.
Using the asadmin script
- Go to the src directory of the sample. For example:
- cd <install_dir>/samples/webservices/jaxrpc/proxy/src
- Run asant using deploy task. For example:
- 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.
The deployment process involves the following operations:
- Go to the proxy directory of the sample. For example:
- cd <install_dir>/samples/webservices/jaxrpc/proxy
- Execute the following command:
- asadmin deploy -u <user-name> -w <password> -H <hostname> -p <admin server port> --instance <instance name> jaxrpc-proxy.war .
- 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
You may now proceed to Running the Sample Application.
- 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
The following steps explain the web-based deployment process.
Running the Sample Application
- Log in to the web-based administration tool from the browser
- Navigate as follows:
- Application Server Instances --> <server instance> --> Applications --> Web Apps
- Click Deploy.
- Click Browse to locate the jaxrpc-dynamic.war file.
- The file is located under <install_dir>/samples/webservices/jaxrpc/proxy/.
- Click OK.
- Enter jaxrpc-proxy in the App Name field.
- Click OK.
- Click the jaxrpc-proxy link to verify that the application is deployed.
- 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.
- Now you are ready to run the application. You may proceed to 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:
Troubleshooting
- cd <install_dir>/samples/webservices/jaxrpc/proxy/src
- Execute the asant run command.
- The program should display the following line:
- A dynamic proxy hello to Buzz!
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.