JaVa
   

Java WSDP Components

The components that come with the Java WSDP download can be classified into four broad categories, shown in Screenshot: Java XML APIs and reference implementations, development and deployment toolsets, the runtime environment, and supporting specifications.

Java Click To expand
Screenshot: Java WSDP components

Java XML APIs

Java WSDP Runtime

Java WSDP comes with the Tomcat Web container, which supports the Servlet 2.3 specification. The Tomcat engine can be started and stopped using the supplied scripts startup/shutdown or can be administered from the browser using the administration console at http://localhost:8080/admin, (shown in Screenshot).

Java Click To expand
Screenshot: The Tomcat Web server administration console

A registry is also an essential part of Web services architecture. Java WSDP comes with a registry server that can be used to test programs written with JAXR. The included registry supports UDDI v. 2 and is to be used as a private registry. The registry uses a native XML database, Xindice (from Apache), and provides a GUI tool to browse and modify registry entries. Setting up the registry is discussed in .

Java WSDP Tools

Ant

Ant is a versatile toolkit used in the context of Java Web service and J2EE to build and deploy apps. Ant's power and versatility as a build tool is evident by the fact that many Integrated Development Environments (IDEs) provide integrated Ant support. Even if you are using Ant from the command line, it is simple to deploy Web service components on a large scale. The default Ant download comes with several built-in tasks (JAR, ZIP, CAB, copy, FTP) and some product- or platform-specific tasks (for Junit testing, EJBC, etc.) in a separate optional download. Java WSDP comes with prebuilt Ant tasks for compiling stubs and skeletons and for deploying Web services to the Tomcat container. Before using Ant to deploy Web services, you should create a build.properties file in your home directory. The file should have the username and password of the Tomcat administrator:

username=<user>
password=<password>


wsdeploy

The wsdeploy tool comes with the Java WSDP package. It is used to create a deployable WAR file that contains all the information necessary to create a JAX-RPC endpoint. The WAR file must then be deployed to Tomcat. Before looking at the syntax for invoking these tools, let's take a look at how a JAX-RPC program is deployed into the Tomcat container. This will provide a high-level introduction to these tools and to Ant. The sample Ant tasks and targets file shown in Screenshot is a modified version of the scripts that come with the Java WSDP tutorial.

Java Click To expand
Screenshot: Sample tasks for creating a JAX-RPC server

Note that wsdeploy is a standalone tool and can be used without using Ant. Screenshot shows the working model.

Java Click To expand
Screenshot: The wsdeploy tool

The syntax for usage is:

wsdeploy <options> <input war file>.
 where <options> are :
 -classpath <path> : classpath (optional)
 -tmpdir <directory> : working directory for generated, temporary files
 -keep : keep temporary files generated (including WSDL
 corresponding to the service)
 -o <output war file> : (required) location of the generated,deployable war file
 -verbose : verbose output
 -version : print version information


The input WAR file contains the server-side classes and two manifest files. The first is the web.xml file, which contains the standard Web app information (see below). The second is, in this particular case, a file specific to JAX-RPC programs created using the Java WSDP and is explained in .

wscompile

The wscompile tool is used to generate the client-side stubs for RPC Web services. This tool is a newer version of the xrpcc tool. (Both provide similar functionality now, but xrpcc will presumably be replaced by wscompile in future releases). The Ant tasks shown below are a high-level illustration of how a JAX-RPC client is packaged. The Ant tasks above provide an overview of the steps needed to create and JAR a JAX-RPC client. These are shown in Screenshot. The syntax for invoking wscompile to generate stubs and/or ties is

Java Click To expand
Screenshot: Sample tasks for creating a JAX-RPC client
wscompile [options] configuration_file where [options] include:
 -classpath <path> classpath
 -d <directory> destination of generated output files
 -g generate debugging info
 -gen same as -gen:client
 -gen:client generate client artifacts (stubs, etc.)
 -gen:server generate server artifacts (ties, etc.)
 -gen:both generate both client and server artifacts
 -keep keep generated files
 -s <directory> location for generated source files
 -verbose output messages about what the compiler is doing
 -version print version information



The configuration file is specific to wscompile. In this example, it provides the location of the WSDL file, so that client-side stubs can be generated from it. The listing below shows a sample configuration file used to generate client-side stubs (i.e., with the gen:client option). A more complete explanation of the configuration file is provided in .

<?xml version="1.0" encoding="UTF-8"?>
<configuration
 xmlns="http://java.oracle.com/xml/ns/jax-rpc/ri/config">
 <wsdl location=" WSDL location"
 packageName="generated file package name"/>
</configuration>


As seen from the syntax for invoking wscompile, the tool can be used to generate both client-side stubs and server-side ties. So far, we have used wsdeploy to generate and package server-side ties. Although not documented, wsdeploy presumably uses wscompile internally, passing it the gen:server argument to generate server-side ties.

Registry Browser

The registry browser is a GUI tool that can be used to search and add information to a UDDI registry. This is shown in Screenshot. It is implemented as a JAXR client and can be used to browse any registry, including the supplied Java WSDP registry. The code for this registry browser (JAXR) can be found in the JAXRClient.java class in the <JWSDP_HOME>/samples/jaxr/jaxr-browser directory.

Java Click To expand
Screenshot: The registry browser

Complete examples of using Ant, wscompile, wsdeploy, and the registry tool are provided in the Java WSDP tutorial, available at http://java.oracle.com/webservices/docs/1.0/tutorial/doc/JavaWSTutorialTOC.html.

Java WSDP Supporting Specifications

Although not directly a part of the XML APIs, the Java WSDP supporting specifications form the core infrastructure of a Web services app and are shipped with the WSDP.


JaVa
   
Comments